### TicTacToe game

Daniel Hüsken · 5 · 5650

#### Daniel Hüsken

• Newbie
• Posts: 3
i created a TicTacToe game. Was my first programming with Phyton. You can find it here https://github.com/danielhuesken/Thumby/blob/main/Games/TicTacToe/TicTacToe.py

Feedback is welcome

#### Void777

• Full Member
• Posts: 16
i created a TicTacToe game. Was my first programming with Phyton. You can find it here https://github.com/danielhuesken/Thumby/blob/main/Games/TicTacToe/TicTacToe.py

Feedback is welcome ;)

Hello, I was looking through your code. Although I haven't had the chance to test it yet. I think that due to the Thumbys very limited storage, these lines become very redundant:

if (postion == 0):
if not playField[6]:
postion = 6
elif not playField[3]:
postion = 3
elif (postion == 6):
if not playField[3]:
postion = 3
elif not playField[0]:
postion = 0
elif (postion == 3):
if not playField[0]:
postion = 0
elif not playField[6]:
postion = 6
elif (postion == 1):
if not playField[7]:
postion = 7
elif not playField[4]:
postion = 4
.       elif (postion == 7):
if not playField[4]:
postion = 4
elif not playField[1]:
postion = 1
elif (postion == 4):
if not playField[1]:
postion = 1
elif not playField[7]:
postion = 7
elif (postion == 2):
if not playField[8]:
postion = 8
elif not playField[5]:
postion = 5
elif (postion == 8):
if not playField[5]:
postion = 5
elif not playField[2]:
postion = 2
elif (postion == 5):
if not playField[2]:
postion = 2
elif not playField[8]:
postion = 8
if (thumby.buttonD.justPressed() == True):
if (postion == 0):
if not playField[3]:
postion = 3
elif not playField[6]:
postion = 6
elif (postion == 3):
if not playField[6]:
postion = 6
elif not playField[0]:
postion = 0
elif (postion == 6):
if not playField[0]:
postion = 0
elif not playField[3]:
postion = 3
elif (postion == 1):
if not playField[4]:
postion = 4
elif not playField[7]:
postion = 7
elif (postion == 4):
if not playField[7]:
postion = 7
elif not playField[1]:
postion = 1
elif (postion == 7):
if not playField[1]:
postion = 1
elif not playField[4]:
postion = 4
elif (postion == 2):
if not playField[5]:
postion = 5
elif not playField[8]:
postion = 8
elif (postion == 5):
if not playField[8]:
postion = 8
elif not playField[2]:
postion = 2
elif (postion == 8):
if not playField[2]:
postion = 2
elif not playField[5]:
postion = 5

I'd suggest something like:
if thumby.buttonD.justPressed()  or thumby.buttonU.justPressed():
for i in range(8):
if postion == i:
if i - 3 > 0 or  i+3 > 8:
i -= 3
elif i + 3 < 8 or i - 3 < 0:
i += 3
if not playField[ i ]:
postion = i

Note I'm on a cell phone so I haven't compiled this yet, but it or something similar should work.
Also I'd fix some of the misspellings as they make the code hard to read.

« Last Edit: October 25, 2021, 02:13:15 PM by Void777 »

#### TARMA

• Full Member
• Posts: 10
i created a TicTacToe game. Was my first programming with Phyton. You can find it here https://github.com/danielhuesken/Thumby/blob/main/Games/TicTacToe/TicTacToe.py

Feedback is welcome

Hello! I've tried Your TicTacToe game and I thank You very much for making it and sharing it with us! Here are a couple of my thoughts and suggestions in case You are planning to continue developing this game:
* I really like the minimalistic look of Your game; however, I would suggest making "lose\win\draw" announcements non-transparent or move it somewhere or change font because currently it blends with TicTacToe's board and is barely readable.
* It would be nice to be able to rematch without the need to restart the system\emulator.
* In future updates I would like to see a mode with a bigger board and the target to connect four "x"\"o".

Good luck with Your game!

#### Daniel Hüsken

• Newbie
• Posts: 3

I'd suggest something like:
if thumby.buttonD.justPressed()  or thumby.buttonU.justPressed():
for i in range(:
if postion == i:
if i - 3 > 0 or  i+3 > 8:
i -= 3
elif i + 3 < 8 or i - 3 < 0:
i += 3
if not playField[ i ]:
postion = i

Note I'm on a cell phone so I haven't compiled this yet, but it or something similar should work.
Also I'd fix some of the misspellings as they make the code hard to read.

Hi i could improve it but no luck with that you suggested. I will commit the changes later so that you can see how.

I will also have a look about the misspellings. Thank you.

#### Daniel Hüsken

• Newbie
• Posts: 3
i created a TicTacToe game. Was my first programming with Phyton. You can find it here https://github.com/danielhuesken/Thumby/blob/main/Games/TicTacToe/TicTacToe.py

Feedback is welcome

Hello! I've tried Your TicTacToe game and I thank You very much for making it and sharing it with us! Here are a couple of my thoughts and suggestions in case You are planning to continue developing this game:
* I really like the minimalistic look of Your game; however, I would suggest making "lose\win\draw" announcements non-transparent or move it somewhere or change font because currently it blends with TicTacToe's board and is barely readable.
* It would be nice to be able to rematch without the need to restart the system\emulator.
* In future updates I would like to see a mode with a bigger board and the target to connect four "x"\"o".

Good luck with Your game!

Yes, i have already some plans for continue developing.
* That is one of my plans, but in moment i have made no decision about how to do it.
* Is on the list. Also showing how man losses and winns and change if you would use x or o. Multiplayer when i know how.
* That is one of the very last, when i will do that, we will see.

SMF spam blocked by CleanTalk