Compare commits

..

1 Commits

Author SHA1 Message Date
528422822d Update README.md 2026-05-05 03:43:50 -05:00
7 changed files with 3 additions and 89 deletions

View File

@@ -1,8 +1,6 @@
Game to have computer guess what number the user is thinking of. Game to have computer guess what number the user is thinking of.
Going to try Lua and bash scripts. See which one I get along better with. ### Goals
## Goals
#### ABSOLUTELY NO AI!!!! #### ABSOLUTELY NO AI!!!!
Rules command Rules command
@@ -13,4 +11,3 @@ Percentage of Variable Number to be number of guesses
maybe 30% ? maybe 30% ?
Play Again? dialog Play Again? dialog
## Outline

View File

@@ -1,21 +0,0 @@
#!/usr/bin/env bash
# set script restart
script=$(readlink -f "$0")
# Select number
echo "Pick a number:"
read num
# Output response
echo "The random number is $((1 + $RANDOM % $num))."
# Ask to run again
echo "Run script again (yes/no)?"
read answer
if [ "$answer" = yes ]
then exec "$script"
fi
echo "Exiting"
exit 0

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

View File

@@ -1,10 +0,0 @@
io.write("Pick a number: ")
local number = io.read("*n")
local randnum = math.random(1, number)
print("The number is ", randnum)
-- ask to rerun script
print("Run again (y/n)?")
local cmd = io.read()
if cmd == "y" then
dofile("randTest.lua")
else end

View File

@@ -1,26 +0,0 @@
-- Assistance from a friend
-- Instantiate all the things
local run = true
local cmd, number, randnum
-- Start a loop
while run == true do
-- Get the users initial number
io.write("Pick a number: ")
number = io.read("*n")
-- Do some mathemagic
-- randnum = math.random(1, number)
print("The random number is ", math.random(1, number))
-- Ask to rerun script
io.read()
print("Run again (Y/n)?")
cmd = io.read("*l")
-- Exit if the user doesn't want to go again
if string.lower(cmd) ~= "y" then
run = false
end
end

View File

@@ -1,26 +0,0 @@
-- Assistance from a friend
-- Instantiate all the things
local run = true
local cmd, number, randnum
-- Start a loop
while run == true do
-- Get the users initial number
io.write("Pick a number: ")
number = io.read("*n")
-- Do some mathemagic
randnum = math.random(1, number)
print("The random number is ", randnum)
-- Ask to rerun script
io.read()
print("Run again (Y/n)?")
cmd = io.read("*l")
-- Exit if the user doesn't want to go again
if string.lower(cmd) ~= "y" then
run = false
end
end