Chess application
This comparison makes each model build a chess web app where the opponent's logic is implemented from scratch
Prompt
# Project: Build a Chess Engine with a Custom Rule and Web Interface Develop a complete, playable chess engine from scratch, including an AI opponent and a browser-based graphical interface. The project must be implemented independently, without using existing chess engines or chess libraries. ## 1. Standard chess rules Implement all standard chess rules: - Normal piece movement and captures. - Legal move generation. - Check and checkmate. - Stalemate. - Castling on both sides. - En passant. - Pawn promotion. - Draw conditions, including repetition and the fifty-move rule. The engine must support arbitrary valid FEN positions, with appropriate handling of the custom rule described below. ## 2. Custom chess rule: Friendly pawn sacrifice Introduce the following additional rule: A pawn may capture an adjacent pawn belonging to its own player. The precise mechanics are: 1. A pawn may capture a friendly pawn immediately to its left or right, provided both pieces are on the same rank. 2. The captured friendly pawn is removed from the board. 3. The capturing pawn is immediately promoted. 4. The player may choose between a rook and a bishop. 5. Promotion to a queen or knight is not permitted through this special action. 6. This action consumes the player's turn. 7. The resulting position must still satisfy all normal king-safety requirements. A player cannot make this move if it leaves their own king in check. This rule is additional to normal pawn movement, captures and promotion rules. Make sure the custom move is correctly integrated into: - Legal move generation. - Move execution and undo. - AI search. - Position evaluation. - Move notation. - The web interface. - Automated testing. Document how this custom action is represented internally and how it is communicated through the engine interface. ## 3. AI opponent Implement an AI opponent using: - Minimax search. - Alpha-beta pruning. - Iterative deepening. - Move ordering. - Transposition tables. - A positional evaluation function. The evaluation function should consider: - Material balance. - Piece-square tables. - King safety. - Pawn structure. - Mobility. - The strategic value of the custom friendly-pawn promotion mechanic. The engine must support configurable search depth and a configurable thinking-time limit. ## 4. Engine architecture Use a modular architecture separating: - Board representation. - Move generation. - Rule validation. - Position evaluation. - Search algorithm. - Game state management. - Communication interface. Do not duplicate chess rules in different components. Implement a UCI interface where possible, extending it with a documented mechanism for the custom move if necessary. ## 5. Web-based graphical interface Develop a complete browser-based GUI that allows a human to play against the engine. Requirements: - Display an interactive 8×8 chessboard. - Display all pieces using recognizable chess symbols or graphics. - Allow pieces to be selected and moved using the mouse. - Highlight legal destinations. - Display the move history in algebraic notation. - Allow the user to choose whether to play White or Black. - Allow restarting a game. - Allow undoing moves. - Allow choosing the AI difficulty or search depth. - Display whose turn it is. - Display check, checkmate, stalemate and draw conditions. - Clearly indicate available special moves. The custom rule must be fully supported in the interface: - When a pawn has an adjacent friendly pawn, indicate that the special move is available if legal. - Allow the user to select the friendly pawn as the capture target. - Display a promotion selector with only rook and bishop options. - Ensure that the engine, not the frontend, determines whether the move is legal. The GUI must communicate with the actual chess engine. Do not implement a separate chess engine or duplicate move-validation logic in JavaScript. ## 6. Technical requirements - No external chess engines or chess-rule libraries. - Standard libraries and general-purpose web frameworks are allowed. - The engine and GUI must be runnable locally. - Prefer a simple architecture that can be installed and launched without complex dependencies. - Include clear instructions for installation and execution. - The GUI should work in a modern desktop browser. - The engine should run locally, without requiring external services or API keys. ## 7. Automated testing Provide an automated test suite covering: ### Standard chess - Normal moves and captures. - Castling. - En passant. - Promotion. - Check and checkmate. - Stalemate. - Draw conditions. - King safety. ### Custom rule - Capturing a friendly pawn horizontally. - Promoting to a rook. - Promoting to a bishop. - Rejecting promotion to a queen or knight. - Rejecting captures of non-pawn friendly pieces. - Rejecting illegal moves that expose the king. - Correct move execution and undo. - Correct AI handling of the special move. ### Performance and correctness - Perft tests against established reference positions for standard chess. - Additional reference tests for the custom rule. - Search tests using tactical positions. - Tests of engine communication with the web interface. ## 8. Deliverables Provide: 1. Complete source code. 2. A working browser-based GUI. 3. A working AI opponent. 4. Automated tests. 5. Installation and launch instructions. 6. Architecture documentation. 7. A description of known limitations. Before declaring the project complete: - Run the automated tests. - Fix any failures. - Verify that the GUI can start a complete game against the engine. - Test the custom rule through the GUI. - Confirm that the engine and GUI agree on the game state. Do not claim that functionality or tests work unless they have actually been implemented and verified. Prioritize correctness, maintainability and a working end-to-end application over superficial completeness.
Response not available
Response not available
Response not available
Response not available