-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Hi there. This is great work! Of course, you're busy, but in case it helps, I took the liberty of tweaking your code a little:
-
I parameterized the steps for each player. Alice you'll see is player 0 and Bob is player 1. Each player now runs from the same code and each player's hashes etc are now referenced by player index.
-
I changed the code to work with the concept of which turn number is being taken for each player rather than with array ranges for the current turn. i.e. player['hashes'][turn][square] rather than player['hashes'][index] with index 0..8 for picking each square on turn 0, 9..17 for turn 1, etc
-
Related to the previous point, I removed some of the modular ( index % 9 ) code and filtering, in favour of some loops to more naturally iterate over per-turn winning and cheating cases that present themselves. Sorry, I found the modular approach very difficult to follow (but I applaud you for actually having the patience to work them all out!). This is a WIP and you might see some yet to be fixed, but I cheated and used e.g. player['hashes'].flat() where I needed to keep your existing code working.
-
I added the hash scripts for winning with a completed column or diagonal, but didn't get round to adding these to the proveVictory() function yet.
I hope this is of use (and sorry for any bugs I introduce - it's possible I missed some in testing!)
Regards
Billy