Skip to content

Add lightweight chess engine, analyzer, CLI executable, tests, and README docs#1

Open
qqpie4634 wants to merge 2 commits intomainfrom
codex/develop-chess-move-analysis-tool
Open

Add lightweight chess engine, analyzer, CLI executable, tests, and README docs#1
qqpie4634 wants to merge 2 commits intomainfrom
codex/develop-chess-move-analysis-tool

Conversation

@qqpie4634
Copy link
Copy Markdown
Owner

Motivation

  • Provide an in-repo chess analysis feature so users can record moves and get engine suggestions without external dependencies.
  • Offer a simple command-line tool to run analysis interactively from the terminal.
  • Expose the new functionality as part of ChatGPTKit so it can be used by library consumers and the CLI.

Description

  • Implement a lightweight chess engine and board model in Sources/ChatGPTKit/Chess/ChessEngine.swift with piece, move, board, legal move generation, evaluation, and basic game state detection.
  • Add a ChessGameAnalyzer in Sources/ChatGPTKit/Chess/ChessAnalyzer.swift that runs a Negamax search with alpha-beta and returns ChessAnalysis and MoveReview summaries.
  • Add an executable CLI target ChessCLI in Sources/ChessCLI/main.swift and expose it in Package.swift as an executable product and executableTarget that depends on ChatGPTKit.
  • Update Sources/ChatGPTKit/ChatGPTKit.swift to import FoundationNetworking to support non-Darwin networking builds and update the README.md with Chinese CLI usage instructions and example code for ChessGameAnalyzer.
  • Add unit tests in Tests/ChatGPTKitTests/ChessAnalyzerTests.swift covering initial legal move count, applying a move, and analyzer suggestion behavior.

Testing

  • Ran swift test which executed the new test suite ChatGPTKitTests and the three tests testInitialPositionHasTwentyLegalMoves, testApplyMoveE2E4, and testAnalyzerSuggestsMove, all of which passed.
  • Performed a swift build of the package to validate the new ChessCLI executable target and library integration, which completed successfully.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant