From e4191ec4a3e04b48880d7b4867e237d08e247074 Mon Sep 17 00:00:00 2001 From: BrianWilkinsFL Date: Tue, 7 Jun 2022 18:52:50 -0400 Subject: [PATCH] Added header. Some comments --- 74_Rock_Scissors_Paper/lua/rockscissors.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/74_Rock_Scissors_Paper/lua/rockscissors.lua b/74_Rock_Scissors_Paper/lua/rockscissors.lua index 0d8708d1..8a19d5da 100644 --- a/74_Rock_Scissors_Paper/lua/rockscissors.lua +++ b/74_Rock_Scissors_Paper/lua/rockscissors.lua @@ -1,3 +1,8 @@ +-- rockscissors.lua +-- Ported by Brian Wilkins (BrianWilkinsFL) +-- Utilized has_key again and choice. A lot of these basic programs +-- follow a similar choice structure so I think I'll use these functions alot. + function getInput(prompt) io.write(prompt) io.flush() @@ -41,6 +46,10 @@ function playGame(n) print("... " .. itemChoices[tostring(computerChoice)]) + -- Working around a Lua thing where I can't seem to interact + -- with function values outside of the function itself + -- So the total wins are calculated outside of this function + -- and summarized. if computerChoice == humanChoice then print("TIE GAME. NO WINNER.") elseif computerChoice > humanChoice then