Aug-15-2017, 09:56 PM
Nilamo's code is an outline of how your program might be run. The player1 and player2 comments show where you would get the moves from those players.
My code has to do with your checkX and checkY functions. They both are a long list of if statements. My first bit of code shows how you could simplify the conditions in those if statements. My second bit of code shows how you could make one loop to to test all the conditions. The lines list would be a list of the index triplets that make a line on the board. That is, the indexes from each of the if conditions in checkX/checkY. Then you can loop through the index triplets and use them to check each line, greatly simplifying your code. All else being equal, simpler code is better. It's easier to maintain, upgrade, and leads to less bugs.
My code has to do with your checkX and checkY functions. They both are a long list of if statements. My first bit of code shows how you could simplify the conditions in those if statements. My second bit of code shows how you could make one loop to to test all the conditions. The lines list would be a list of the index triplets that make a line on the board. That is, the indexes from each of the if conditions in checkX/checkY. Then you can loop through the index triplets and use them to check each line, greatly simplifying your code. All else being equal, simpler code is better. It's easier to maintain, upgrade, and leads to less bugs.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures