Question
Using Pythong to make a Tic-tac-toe game in a 2D list where EMPTY = 0 X = 1 O = 2. I'm currently struggling with
Using Pythong to make a Tic-tac-toe game in a 2D list where
EMPTY = 0 X = 1 O = 2.
I'm currently struggling with Part 6
Part 6: Checking if a player has won We will now use your sub-functions to determine if a player has won the current board. In effect, the question of whether a player has won is equivalent to the question of if the player has a win in any row, a win in any column, or a win in any diagonal. Create a function named won . The function will take 2 parameters: 1. a two-dimensional list that holds a representation of the board game-state 2. the piece type of one of the playersThe function will return True if the player has a win in the board, or False if the player has not won. The following pseudo-code should help. Note, that the if-statements are asking a question we already created sub-functions to answer. Make use of your sub-functions in those locations. Your solution should be the same length as this pseudo-code when complete. /
For every row board If win in that row Return True For every column in board If win in that column Return True If win in diagonal Return true Otherwise return false
Thanks a lot for helping out!!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started