How dev-rafayel/games-c-js works
The repository contains three standalone games: a browser chess game, a C terminal tic-tac-toe game, and a browser tic-tac-toe game. Chess separates board state and move coordination from piece-specific move rules and DOM rendering; each tic-tac-toe implementation handles its own input, game state, win/draw detection, and presentation. The supplied excerpts support the chess call relationships; the two tic-tac-toe games are each implemented in a single file.
Main entry points: main.js Board state · Piece.js Piece base · board.js Board interface · Pawn.js Pawn moves
Components 14
Chess rules
- Board state
Chess/Game_logic/main.js - Piece base
Chess/Pieces/Piece.js - Pawn moves
Chess/Pieces/Pawn.js - Rook moves
Chess/Pieces/Rook.js - Knight moves
Chess/Pieces/Knight.js - Bishop moves
Chess/Pieces/Bishop.js - Queen moves
Chess/Pieces/Queen.js - King moves
Chess/Pieces/King.js
Chess interface
- Board interface
Chess/UI/board.js
C tic-tac-toe
- Terminal game
C_tictactoe/code.c
Browser tic-tac-toe
- Browser game
JS_tictactoe/game.js
Other components
- Chess player
- Terminal player
- Browser player
Connections 17
- Chess player → Board interface: clicks squares
Chess/UI/board.js - Board interface → Board state: queries moves
Chess/UI/board.js - Board interface → Board state: applies moves
Chess/UI/board.js - Board state → Pawn moves: creates pieces
Chess/Game_logic/main.js - Board state → Rook moves: creates pieces
Chess/Game_logic/main.js - Board state → Knight moves: creates pieces
Chess/Game_logic/main.js - Board state → Bishop moves: creates pieces
Chess/Game_logic/main.js - Board state → Queen moves: creates pieces
Chess/Game_logic/main.js - Board state → King moves: creates pieces
Chess/Game_logic/main.js - Pawn moves → Piece base: extends
Chess/Pieces/Pawn.js - Rook moves → Piece base: extends
Chess/Pieces/Rook.js - Knight moves → Piece base: extends
Chess/Pieces/Knight.js - Bishop moves → Piece base: extends
Chess/Pieces/Bishop.js - Queen moves → Piece base: extends
Chess/Pieces/Queen.js - King moves → Piece base: extends
Chess/Pieces/King.js - Terminal player → Terminal game: enters moves
C_tictactoe/code.c - Browser player → Browser game: clicks cells
JS_tictactoe/game.js