mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-09 11:46:24 -08:00
MAINT: Apply pre-commit
Remove byte-order-marker pre-commit check as there would be many adjustments necessary
This commit is contained in:
@@ -12,10 +12,10 @@ function input()
|
||||
{
|
||||
var input_element;
|
||||
var input_str;
|
||||
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
input_element = document.createElement("INPUT");
|
||||
|
||||
|
||||
print("? ");
|
||||
input_element.setAttribute("type", "text");
|
||||
input_element.setAttribute("length", "50");
|
||||
@@ -61,7 +61,7 @@ async function main()
|
||||
print("OF A NUMBER BETWEEN 1 AND ANY LIMIT YOU WANT.\n");
|
||||
print("THEN YOU HAVE TO GUESS WHAT IT IS.\n");
|
||||
print("\n");
|
||||
|
||||
|
||||
print("WHAT LIMIT DO YOU WANT");
|
||||
l = parseInt(await input());
|
||||
print("\n");
|
||||
|
||||
@@ -48,5 +48,3 @@ sub ENTERS { #GOSUB 70
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ while True:
|
||||
won = False
|
||||
my_guess = int(limit * random() + 1)
|
||||
|
||||
print("I'm thinking of a number between 1 and {}".format(limit))
|
||||
print(f"I'm thinking of a number between 1 and {limit}")
|
||||
print("Now you try to guess what it is.")
|
||||
|
||||
while still_guessing:
|
||||
@@ -79,7 +79,7 @@ while True:
|
||||
print("Too high. Try a smaller answer")
|
||||
guess_count += 1
|
||||
else:
|
||||
print("That's it! You got it in {} tries".format(guess_count))
|
||||
print(f"That's it! You got it in {guess_count} tries")
|
||||
won = True
|
||||
still_guessing = False
|
||||
|
||||
@@ -89,7 +89,7 @@ while True:
|
||||
elif guess_count == limit_goal:
|
||||
print("Good.")
|
||||
else:
|
||||
print("You should have been able to get it in only {}".format(limit_goal))
|
||||
print(f"You should have been able to get it in only {limit_goal}")
|
||||
insert_whitespaces()
|
||||
else:
|
||||
insert_whitespaces()
|
||||
|
||||
@@ -6,4 +6,4 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
rand = "0.8.4"
|
||||
rand = "0.8.4"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
use rand::Rng;
|
||||
use std::io;
|
||||
use std::cmp::Ordering;
|
||||
// Rust haven't log2 in the standard library so I added fn log_2
|
||||
// Rust haven't log2 in the standard library so I added fn log_2
|
||||
const fn num_bits<T>() -> usize { std::mem::size_of::<T>() * 8 }
|
||||
|
||||
fn main() {
|
||||
@@ -94,7 +94,7 @@ fn set_limit() -> i64 {
|
||||
|
||||
if inp >= 2 {
|
||||
inp
|
||||
}
|
||||
}
|
||||
else {
|
||||
set_limit()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user