Here is the code, and I will point out where I run aground.
-
--Translation Notes: The 'x' in the TI version -
--has become 'b' -
term.clear() -
term.setCursorPos(1, 1) -
local n -
local m -
n = 1000 -
m = 30 -
print( "Highest Number: " ..n) -
print( "Max Turns: " ..m) -
os.sleep(3) -
local b -
local x -
local a -
local t -
a = "nil" -
x = math.random(1, n) -
x = b -
for t = 1, 3, 1 do --Make 3 'm' before finishing -
term.clear() -
term.setCursorPos(1, 1) -
print( b ) -
print( "Turn: "..t ) -
print( "Last Guess: "..a ) -
print( " " ) -
print( "Guess a number!" ) -
a = read() -
if a==b then -
term.clear() -
term.setCursorPos(1, 1) -
print( "You win!" ) -
os.sleep(1) -
break -
end -
end
I run aground right here:
-
if a==b then
I am going to assume that this is a problem with Lua being unable to check variables against themselves, or me not using the right command, or whatever.
ASIDE:
I also have a problem here:
-
x = b
But that part of the code can be cut out, and I will just not use 'b' at all. The only reason I did use it was to check if variables could carry over data like that. They can't.
Program can be found here: http://pastebin.com/9qSL2S09












