#๐ Help with a tic tac toe project
28 messages ยท Page 1 of 1 (latest)
@sharp root
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
def is_victory(icon):
return (board[0] == icon and board[1] == icon and board[2] == icon) or \
(board[3] == icon and board[4] == icon and board[5] == icon) or \
(board[6] == icon and board[7] == icon and board[8] == icon) or \
(board[0] == icon and board[3] == icon and board[6] == icon) or \
(board[1] == icon and board[4] == icon and board[7] == icon) or \
(board[2] == icon and board[5] == icon and board[8] == icon) or \
(board[0] == icon and board[4] == icon and board[8] == icon) or \
(board[2] == icon and board[4] == icon and board[6] == icon)
this is my way of making it
I don't know how to make it like he suggested
because going over every possible instance is slow and just not a good way to check the winner
well technically you are not checking every single condition unless they all fail
we have something called short circuiting in modern languages, if you have a condition like x == 5 or x == 6 and it finds that the first one is True it wont evaluate the second one at all
he asked: what if you wanted to show me who won mathematically, how would you do that?
hmm are you storing integers in your board? what is icon
he might mean boolean arithmetic, where you do math using bools
!paste sure
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
yeah I'm not sure what he means 
lol
np, good luck with your code
oh alright thanks! cya around
please share the answer
i will
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.
๐ Help with a tic tac toe project