Refactor bot server setup to use Waitress for production; fallback to Flask dev server for local development. Added timeout to HTTP requests in Fun and Test cogs. Improved error handling for missing environment variables. Enhanced secret key management in Flask app. Added request timeout configuration. Introduced new experimental features including user profile and balance cards, and a Tic-Tac-Toe game with Minimax AI. Addressed various database and security issues, and improved code quality across multiple files.
This commit is contained in:
Executable
+30
@@ -0,0 +1,30 @@
|
||||
from minimax import aiO, aiX, Terminal, Value
|
||||
# from player import player
|
||||
|
||||
|
||||
def display_board(board):
|
||||
print('-------------')
|
||||
for row in [board[i:i + 3] for i in range(0, 9, 3)]:
|
||||
print(f'| {row[0]} | {row[1]} | {row[2]} |')
|
||||
print('-------------')
|
||||
|
||||
def main():
|
||||
results = []
|
||||
while True:
|
||||
board = [" " for _ in range(9)]
|
||||
# board = ['O', 'X', 'O','O', 'X', 'X',' ', ' ', 'X']
|
||||
display_board(board)
|
||||
while True:
|
||||
board[aiX(board)] = "X"
|
||||
display_board(board)
|
||||
if Terminal(board):
|
||||
break
|
||||
board[aiO(board)] = "O"
|
||||
display_board(board)
|
||||
if Terminal(board):
|
||||
break
|
||||
results.append(Value(board))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user