How sarl23/tres-en-raya works
Project type and purpose
• This is a full-stack Python web application (Flask) implementing a “Tres en Raya” (Tic-Tac-Toe) game with an AI agent (Minimax + α-β pruning).
• The README explains that the UI is delivered via HTML/CSS/JavaScript (Bootstrap + custom JS), while game logic and intelligent agent are executed in Python inside app.py using Flask, Jinja2 and Werkzeug.
File structure
• Top level:
• app.py (Flask application entry point, routes, business logic)
• requirements.txt (.e.g. Flask, Werkzeug, Jinja2)
• static/ (all CSS, JS, images – primarily Bootstrap v4.3.1 assets + custom scripts)
• templates/index.html (Jinja2 template for the game UI)
• Pattern: A lightweight MVC-style layering:
• Model/Logic: game state vectors and Minimax agent in Python
• View: Jinja2 template + static assets
• Controller: Flask routes handling HTTP requests (GET for page load, POST for moves)
README for additional insights
• Interaction: on button click the frontend sends a POST request with JSON payload containing: user move index, current user/machine vectors, combined moves, available moves.
• Backend computes the next move via the intelligent agent and returns updated game state to the frontend.
• No external database is present; any “dataset of past games” would be an in-memory structure or file loaded by app.py.
Final advice
• Be exhaustive in breaking down the system: even though it’s a small app, illustrate each logical piece separately (static file service, template engine, HTTP routes, game engine).
• Every essential flow (page load, move submission, AI computation, state update).