Quote: "here in America we call it "Rock, paper, scissors"
"
same in England, but I think perhaps that the translation got mucked up somewhere. lol. nice game Damokles.
I have attached the code with english remarks. I have also changed the variable EndroitClique with PlaceClicked
Rem * Title : Paper Scissors Stone
Rem * Author : Michel Aziotou
Rem * Date : 31-10-2004
RANDOMIZE TIMER() : SYNC ON
SET DISPLAY MODE 800,600,16
DISABLE ESCAPEKEY
GameFinish = 0 : `Finish variable
ChangeDelay = 100 : `Determine how long to wait between the ai images
DIM Score(2) : `Create an array in which the score will be posted (1 for the player, 2 for the computer)
LOAD IMAGE "sprites\paper.png",1
LOAD IMAGE "sprites\scissors.png",2
LOAD IMAGE "sprites\stone.png",3
FOR x = 1 TO 3
SPRITE x,0,0,x
NEXT x
CLS
` Begin the first loop
REPEAT
ThisTime = 0 : `Begin the sequence for "ChangeDelay"
ComputerChoice = 1 : `The computer's choice
PlayerChoice = 1 : `The player's choice
MenuFlag = 0 : `if anything was selected
Finish = 0 : `If the game is finished
` begin the second loop
REPEAT
`change the computer selection
IF TIMER() > ThisTime + ChangeDelay
INC ComputerChoice
ThisTime = TIMER()
IF ComputerChoice = 4 THEN ComputerChoice = 1
ENDIF
Rem - get the place that the player clicks on
IF MOUSECLICK() = 1
PlaceClicked = 0 : `determine the place clicked variable
IF MenuFlag = 0 THEN MenuFlag = 1 : ` say that the menu was clicked
IF mouseover(260,260,80,80) = 1 THEN PlaceClicked = 1
IF mouseover(260,240,80,20) = 1 THEN PlaceClicked = 2
IF mouseover(260,340,80,20) = 1 THEN PlaceClicked = 3
IF mouseover(760,560,40,40) = 1 THEN PlaceClicked = 4
ENDIF
Rem - find out what happens when the mouse button is pressed
IF MenuFlag = 1 AND MOUSECLICK() = 0
MenuFlag = 0
IF PlaceClicked = 1 THEN Finish = 1 : ` play the players choice
IF PlaceClicked = 2 THEN DEC PlayerChoice : ` change the player's choice
IF PlaceClicked = 3 THEN INC PlayerChoice : ` change the player's choice
IF PlayerChoice = 0 THEN PlayerChoice = 3
IF PlayerChoice = 4 THEN PlayerChoice = 1
IF PlaceClicked = 4 THEN Finish = 1 : GameFinish = 1 : ` end the game
ENDIF
`draw things to the screen
INK RGB(0,255,0),0
BOX 260,260,340,340
BOX 460,260,540,340
IF MOUSECLICK() = 1 AND PlaceClicked = 2 THEN INK RGB(0,0,155),0 ELSE INK RGB(0,0,255),0
BOX 260,240,340,260
IF MOUSECLICK() = 1 AND PlaceClicked = 3 THEN INK RGB(0,0,155),0 ELSE INK RGB(0,0,255),0
BOX 260,340,340,360
IF MOUSECLICK() = 1 AND PlaceClicked = 4 THEN INK RGB(155,0,0),0 ELSE INK RGB(255,0,0),0
BOX 760,560,799,599
PASTE SPRITE PlayerChoice,260,260
PASTE SPRITE ComputerChoice,460,260
SYNC
UNTIL Finish = 1
WhoWins = 2 : `find out who wins
IF PlayerChoice = ComputerChoice THEN WhoWins = 0
IF PlayerChoice = 1 AND ComputerChoice = 3 THEN WhoWins = 1
IF PlayerChoice = 2 AND ComputerChoice = 1 THEN WhoWins = 1
IF PlayerChoice = 3 AND ComputerChoice = 2 THEN WhoWins = 1
Score(WhoWins) = Score(WhoWins) + 1
PRINT WhoWins
INK 0,0
BOX 260,200,540,240
INK RGB(0,0,255),0
TEXT 300,220,STR$(Score(1))
TEXT 500,220,STR$(Score(2))
CENTER TEXT 400,220,"Click to play"
REPEAT : SYNC : UNTIL Mouseclick()=1
UNTIL GameFinish = 1
FOR x = 1 TO 3
DELETE IMAGE x
DELETE SPRITE x
NEXT x
UNDIM Score(2)
END
FUNCTION mouseover(x_pos,y_pos,width,height)
Rem - see if the mouse is over something
value = 0
IF MOUSEX()>x_pos and MOUSEX()<x_pos+width
IF MOUSEY()>y_pos and MOUSEY()<y_pos+height
value=1
ELSE
value=0
ENDIF
ENDIF
ENDFUNCTION value
Part of solving the problem is actually noticing that the problem is there in the first place