Posted 11 June 2012 - 10:20 PM
From what I understand I should be looking for a typo, but I can't find it.
This is the error: bios:206: [string "RPS" ]:42: ')' expected
This is the code:
local playerscore=0
local computerscore=0
for Variable = 1, 3 do
local x=read()
local y=math.random(3)
if y==1
then print("Rock")
elseif y==2
then print("Paper")
elseif y==3
then print("Scissors")
end
if (x=="rock" and y==1) or
(x=="paper" and y==2) or
(x=="scissors" and y==3)
then sleep(1) print("Draw!")
elseif (x=="rock" and y==2) or
(x=="paper" and y==3) or
(x=="scissors" and y==1)
then sleep(1) print("Computer wins round!")
computerscore=computerscore+1
elseif (x=="rock" and y==3) or
(x=="paper" and y==1) or
x=="scissors" and y==2)
then sleep(1) print ("Player wins round!")
playerscore=playerscore+1
end
end
if (computerscore=playerscore)
then print("Draw!")
elseif (playerscore>computerscore)
then term.clear()
print("YOU WIN!")
elseif (playerscore<computerscore)
then print("YOU FAIL!")
end
_______________
Thanks a lot
This is the error: bios:206: [string "RPS" ]:42: ')' expected
This is the code:
local playerscore=0
local computerscore=0
for Variable = 1, 3 do
local x=read()
local y=math.random(3)
if y==1
then print("Rock")
elseif y==2
then print("Paper")
elseif y==3
then print("Scissors")
end
if (x=="rock" and y==1) or
(x=="paper" and y==2) or
(x=="scissors" and y==3)
then sleep(1) print("Draw!")
elseif (x=="rock" and y==2) or
(x=="paper" and y==3) or
(x=="scissors" and y==1)
then sleep(1) print("Computer wins round!")
computerscore=computerscore+1
elseif (x=="rock" and y==3) or
(x=="paper" and y==1) or
x=="scissors" and y==2)
then sleep(1) print ("Player wins round!")
playerscore=playerscore+1
end
end
if (computerscore=playerscore)
then print("Draw!")
elseif (playerscore>computerscore)
then term.clear()
print("YOU WIN!")
elseif (playerscore<computerscore)
then print("YOU FAIL!")
end
_______________
Thanks a lot