Recognize all valid TPS, and recognize some variations on TPS.
Gracefully handle invalid TPS with messages about what was wrong.
Properly allow player to begin playing a loaded tps. There were previously some anomalies.
Previous code had wrong expectation for TPS notation of a StandingStone. Was using W for Wall.
Disallow players from continuing play after the game has ended.
board.init() method has been split into board.create() and board.initEmpty(). And there is also my new initFromTPS()
introduced a couple of new variables:
movestart... we now allow a game to start in the middle and properly notate the move number. This is important so that
we don't try to back up before the first move we have recorded.
isPlayEnded.. to indicate the game is finished and players should not be able to continue making moves.
I changed a few variable names and method names:
col >>>> color [to avoid confusion, since 'col' frequently is shorthand for 'column']
push >>>> pushPieceOntoSquare [for clarity]
loadtpn >>>> loadtps
Did some minor refactoring (e.g. Extract Method)
Fixed the indentation of some functions that I was working in.
I added quite a few comments to help elucidate the meaning of variables or methods... initially this was for myself as I figured out how the code was working, but I figured other developers might find it helpful (or yourself a few months down the road if you forget how something is working).
I tend to be generous in my comments. Over years of SW development I find that I can't always remember what my code was doing, or how it was supposed to work... even if I come back to it in a relatively short time.
introduced a couple of new variables:
movestart... we now allow a game to start in the middle and properly notate the move number. This is important so that we don't try to back up before the first move we have recorded.
isPlayEnded.. to indicate the game is finished and players should not be able to continue making moves.
I tend to be generous in my comments. Over years of SW development I find that I can't always remember what my code was doing, or how it was supposed to work... even if I come back to it in a relatively short time.