I have now come across an exercise there, where I am stuck (and it's just one of the few that are only partially documented).
The Match Game*. The idea is that the children check and complete the given code. Either it is really extremely difficult (which I don't believe) or I am struck by blindness or after x attempts I just go round in circles. Has anyone here ever programmed such a game and could help me? (There is a similar game here in the forum with code to download, but it has a completely different approach behind it). Maybe I just didn't try enough, but computer science is one of twelve school subjects I have to teach, and now with home schooling (a.k.a video conferencing), preparation takes twice as long and I still have to coach the overstrained parents.
Stay in good health and best regards,
G.
*https://sites.google.com/a/pgcps.org/li ... e/matching
see https://sites.google.com/a/pgcps.org/li ... e/matching for further detailsStart of the Logic
See if you can follow the logic of the game as it is written below. This is a start. It may not work and it will give you some practice debugging. The rest of the code also has to be written...
adding the code to the card:
Code: Select all
global card1, card2 global numLeft, numClicked on openCard put empty into card1 put empty into card2 put empty into numClicked put 12 into numLeft end openCard on mouseUp if the first char of the short name of the target is "b" then if Card1 is empty then turnCardOver put currCard into card1 else if card2 is empty turnCardOver put currCard into card2 if card1 is equal to card2 then subtract 2 from numLeft if numLeft = 0 then answer "Game over" end if else turnCardBack card1 turnCardBack card2 end if end if end if end mouseUp command turnCardOver hide the target put the second char of the short name of the target into currCard put "A" & currCard into x show button x end turnCardOver command turnCardBack cardNum hide button "A" & cardNum show button "B" & cardNum Add 1 to numLeft end turnCardBack
Now test the code, debug it and add additional logic to make the game better