+ 4
[Challenging question] checking 2d array[tic tac toe]
I already did my Tic Tac Toe game in python using Minimax algorithm( only 3x3 board) . So I decided i will try to make tic tac toe AI for bigger boards. Problem I had was my checkWin function. It is not that easy to check if anybody win,if player can choose size of the board(for example 5x10, 7x2). Today finally i completed this checkWin function. I did not use any library like numpy(if i did it would be much, much easier). So i am asking: How would you make this checkWin function. I am still learning python and i am interested how other programmers would do it. (It has to check board vertically, horizontally and all diagonals). More information about my solution in my code. https://code.sololearn.com/c785sAlA6AUS/?ref=app
3 odpowiedzi
+ 1
I dont understand, I just tested it horizontally, vertically and diagonally, everything seemed to pass. What issues are you experiencing?
+ 1
Mirielle I am sorry, but I don't understand you. Could you please illustrate this in Sololearn playgroud, like I did with my solution(it should have 2d array, which represents playing board and checkWin function, which returns True if player won, False if player did NOT win) Thanks.
https://code.sololearn.com/c785sAlA6AUS/?ref=app