DEV Community

Discussion on: Tic-Tac-Toe you can't beat...

 
james_palermo_bc208e463e4 profile image
James Palermo

If you have two people, Alice and Bob, who both know the solution, every game will be a draw. If a third player, Charlie, doesn't know the solution, as long as Alice goes first against Charlie she will always win.

Thread Thread
 
dhhruv profile image
Dhruv Panchal

Yeah, that makes sense. But, I thought in the same example maybe the computer can think like Bob and know what's next so...

Thread Thread
 
james_palermo_bc208e463e4 profile image
James Palermo

Your code is very neatly done, but you really should try to get in the habit of commenting on what functions do in a clear way, and when you introduce a new variable say what it is.

For example, at line 51 by looking at the function "def bconv(TTT):" i can immediately tell this thing is converting from B to T. I have no idea what B and T is, or why you're converting them in the first place.

Bacons to tomatoes? :D

Thread Thread
 
james_palermo_bc208e463e4 profile image
James Palermo • Edited

You should also clear the mouse input buffer and reinit it after laucnhing and between games. :D

youtu.be/48OqfWgv9ak

Thread Thread
 
dhhruv profile image
Dhruv Panchal

Yeah, actually cleaning of the code and comments is still in progress so I'll add comments to make them clear and look into flushing the mouse input. Thanks for the help.😁