mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-05 09:39:32 -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:
@@ -209,4 +209,4 @@ public class RockScissors {
|
||||
RockScissors rockScissors = new RockScissors();
|
||||
rockScissors.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -24,7 +24,7 @@ for (my $G=1; $G<=$Q; $G++) {
|
||||
do {
|
||||
print "3=ROCK...2=SCISSORS...1=PAPER\n";
|
||||
print "1...2...3...WHAT'S YOUR CHOICE? "; chomp($K = <STDIN>);
|
||||
if (($K-1)*($K-2)*($K-3)!=0) { print "INVALID.\n"; $K=0; }
|
||||
if (($K-1)*($K-2)*($K-3)!=0) { print "INVALID.\n"; $K=0; }
|
||||
} until ($K!=0);
|
||||
|
||||
|
||||
@@ -52,5 +52,3 @@ print "YOU HAVE WON $H GAME(S).\n";
|
||||
print "AND ".($Q-($C+$H))." GAME(S) ENDED IN A TIE.\n";
|
||||
print "\n"; print "THANKS FOR PLAYING!!\n";
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
@@ -76,8 +76,7 @@ def main():
|
||||
|
||||
play_game()
|
||||
|
||||
keep_playing = input(
|
||||
"Play again? (yes or no) ").lower().startswith("y")
|
||||
keep_playing = input("Play again? (yes or no) ").lower().startswith("y")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -18,7 +18,7 @@ end
|
||||
|
||||
def ask_for_number_of_games
|
||||
loop do
|
||||
puts "HOW MANY GAMES"
|
||||
puts "HOW MANY GAMES"
|
||||
response = STDIN.gets.to_i
|
||||
return response if response > 0 and response < 11
|
||||
puts "SORRY, BUT WE AREN'T ALLOWED TO PLAY THAT MANY."
|
||||
@@ -58,7 +58,7 @@ number_of_games.times do |game_number|
|
||||
human_move = ask_for_human_move
|
||||
puts "THIS IS MY CHOICE..."
|
||||
puts "...#{MOVE_WORDS[computer_move]}"
|
||||
|
||||
|
||||
case calculate_result(human_move, computer_move)
|
||||
when 'WIN'
|
||||
puts "YOU WIN!!!"
|
||||
@@ -77,4 +77,3 @@ puts "I HAVE WON #{games_lost} GAME(S)."
|
||||
puts "YOU HAVE WON #{games_won} GAME(S)."
|
||||
puts "AND #{number_of_games - (games_lost + games_won)} GAME(S) ENDED IN A TIE."
|
||||
puts "THANKS FOR PLAYING!!"
|
||||
|
||||
|
||||
@@ -7,4 +7,4 @@ edition = "2021"
|
||||
text_io = "0.1.10"
|
||||
strum = "0.24"
|
||||
strum_macros = "0.24"
|
||||
nanorand = "0.6.1"
|
||||
nanorand = "0.6.1"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Rust](https://www.rust-lang.org)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user