This commit is contained in:
SpudGunMan
2025-10-06 14:08:07 -07:00
parent 2045bf98f7
commit e137420138
2 changed files with 6 additions and 8 deletions
+1 -1
View File
@@ -832,7 +832,7 @@ def handleTicTacToe(message, nodeID, deviceID):
"nodeID": nodeID,
"last_played": time.time()
})
msg = "🎯Tic-Tac-Toe🤖 'end' to quit\n"
msg = "🎯Tic-Tac-Toe🤖 '(e)nd' to Quit\n"
msg += tictactoe.play(nodeID, message)
+5 -7
View File
@@ -1,8 +1,8 @@
# Tic-Tac-Toe game for Meshtastic mesh-bot
# Human is X, bot is O
# Board positions chosen by numbers 1-9
# 2025
import random
# to molly and jake, I miss you both so much.
class TicTacToe:
def __init__(self):
@@ -131,11 +131,11 @@ class TicTacToe:
if winner == "X":
g["won"] += 1
return "🎉You won!"
return "🎉You won! (n)ew (e)nd"
elif winner == "O":
return "🤖Bot wins!"
return "🤖Bot wins! (n)ew (e)nd"
else:
return "🤝Tie game!"
return "🤝Tie game! (n)ew (e)nd"
def play(self, id, input_msg):
"""Main game play function"""
@@ -201,8 +201,6 @@ class TicTacToe:
def end_game(self, id):
"""Clean up finished game but keep stats"""
if id in self.game:
games = self.game[id]["games"]
won = self.game[id]["won"]
# Remove game but we'll create new one on next play
del self.game[id]
@@ -214,4 +212,4 @@ class TicTacToe:
# Global instances for the bot system
tictactoeTracker = []
tictactoe = TicTacToe()
tictactoe = TicTacToe()