Skip to content

Conversation

ernestcr
Copy link

This commit introduces a complete Tic-Tac-Toe game implemented as a single React component in TicTacToe.tsx.

Key features include:

  • Title: "Juego de Michi del Prof. Ernesto Cancho."
  • A clear 3x3 grid with high-contrast borders.
  • Player vs. Player (PvP) mode.
  • Player vs. Computer (PvC) mode with basic AI:
    • AI attempts to win.
    • AI blocks your winning moves.
    • AI prioritizes center, then corners, then sides.
    • All AI logic is implemented locally within the component.
  • Interactive clickable cells that display 'X' or 'O'.
  • Clear indicators for player turns, wins, and draws.
  • A "Play Again" button to restart the game in the current mode.
  • All UI and game logic are self-contained in the single .tsx file, using inline styles.

I followed a structured plan, adding features incrementally:

  1. Initial file creation and basic UI.
  2. Cell click and mark placement.
  3. Player turn alternation.
  4. Win condition logic.
  5. Draw condition logic.
  6. "Play Again" functionality.
  7. Player vs. Computer mode with AI.
  8. Final code review and verification of requirements.

This commit introduces a complete Tic-Tac-Toe game implemented as a single React component in `TicTacToe.tsx`.

Key features include:
- Title: "Juego de Michi del Prof. Ernesto Cancho."
- A clear 3x3 grid with high-contrast borders.
- Player vs. Player (PvP) mode.
- Player vs. Computer (PvC) mode with basic AI:
    - AI attempts to win.
    - AI blocks your winning moves.
    - AI prioritizes center, then corners, then sides.
    - All AI logic is implemented locally within the component.
- Interactive clickable cells that display 'X' or 'O'.
- Clear indicators for player turns, wins, and draws.
- A "Play Again" button to restart the game in the current mode.
- All UI and game logic are self-contained in the single .tsx file, using inline styles.

I followed a structured plan, adding features incrementally:
1. Initial file creation and basic UI.
2. Cell click and mark placement.
3. Player turn alternation.
4. Win condition logic.
5. Draw condition logic.
6. "Play Again" functionality.
7. Player vs. Computer mode with AI.
8. Final code review and verification of requirements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant