05-10-2021, 03:04 PM
(05-06-2021, 06:40 PM)MatthewStephenson Wrote: Hi,Thank you Matthew,
The problem with the image sizes should be fixed in the next release :)
Cheers,
Matthew
So the remaining issues with my Battleship implementation are largely cosmetic. (They do affect game play a little but not enormously). I would be prepared to submit my implementation now trusting that it will all work out.
However I still have one more issue, cosmetic I guess.
When the game ends I think the whole board should be unhidden. I looked at how Mastermind does this. Basically every move has a then clause which checks to see if the game has ended and if it has unhide the board.
Now in this case, unhiding the board will mess up the victory condition so I need to set a variable and check that. Then in the end rules I simply check the variable.
Now I hit a further complication that there already is a (then ...) clause in that spot. Like this:
Code:
(define "ClearShotSpace"
(do
(set State at:(last From) ("Hit"))
next:(set Hidden at:(last From) False to:Mover)
)
)
......
(then
("ClearShotSpace")
)
Code:
(then
(do
("ClearShotSpace")
next:("CheckForVictory")
)
)
I attach a version which is broken in this way. If you remove the out (do ,,,) wrapper around ("ClearShotSpace") it reverts to what works best so far.
I was hoping to produce a test case. However I am struggling with that.I wanted to create a deck of cards and deal those to the board, but I can't get that to work. So far I have tried
Code:
(deck cardsBySuit:25 suits:1)