Skip to content

idylicaro/go-chess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Chess

Directory Overview

├── cmd/
│   ├── server/
│   │    └── main.go
│   └── cli/
│       └── main.go
├── internal/
│   ├── chess/
│   │   ├── board.go
│   │   ├── piece.go
│   │   ├── game.go
│   ├── uci/
│   │   └── protocol.go
│   ├── common/
│   │   └── piece.go
├── debug/
│   ├── debug.go
│   └── chess.go
│   └── timer/
│      └── timer.go
├── pkg/
    └── game_engine/
        └── engine.go
  • cmd/
    Contains the executables for the project. Each subdirectory is a separate program that can be built and run.

    • cmd/server/
      Backend server responsible for managing matches, multiplayer features, and communication with the AI. The entry point is main.go.

    • cmd/cli/
      Command-line interface for interacting with the chess engine.

  • internal/
    Core logic of the project, intended for internal use only and not meant to be imported by other projects.

    • internal/chess/
      Implements the chess engine logic:

      • board.go: Board representation.
      • piece.go: Piece definitions and properties.
      • game.go: Game state management (turns, check, etc.).
    • internal/common/ Handles common utilities and types used across the project.

    • internal/debug/
      Provides debugging utilities and logging for the chess engine.

    • internal/timer/
      Implements timing and time control features for the chess engine.

    • internal/uci/
      Handles communication with Stockfish using the UCI protocol.

      • protocol.go: Functions for sending commands and parsing responses.
    • scripts/
      Contains utility scripts for development and testing.

UCI Command Processing

The UCI format for a move is a string like "e2e4".

       a b c d e f g h
    8 [ ][ ][ ][ ][ ][ ][ ][ ]
    7 [ ][ ][ ][ ][ ][ ][ ][ ]
    6 [ ][ ][ ][ ][ ][ ][ ][ ]
    5 [ ][ ][ ][ ][ ][ ][ ][ ]
    4 [ ][ ][ ][ ][ ][ ][ ][ ]
    3 [ ][ ][ ][ ][ ][ ][ ][ ]
    2 [ ][ ][ ][ ][ ][ ][ ][ ]
    1 [ ][ ][ ][ ][ ][ ][ ][ ]

Internal board Overview

       0 1 2 3 4 5 6 7
    0 [ ][ ][ ][ ][ ][ ][ ][ ]
    1 [ ][ ][ ][ ][ ][ ][ ][ ]
    2 [ ][ ][ ][ ][ ][ ][ ][ ]
    3 [ ][ ][ ][ ][ ][ ][ ][ ]
    4 [ ][ ][ ][ ][ ][ ][ ][ ]
    5 [ ][ ][ ][ ][ ][ ][ ][ ]
    6 [ ][ ][ ][ ][ ][ ][ ][ ]
    7 [ ][ ][ ][ ][ ][ ][ ][ ]

TODO

  • Parser para notação algébrica padrão, Geração de notação algébrica para output, Ambiguidade resolution (Nbd2 vs Nfd2).
  • CLI with charmbracelet/bubbletea.

How to build

To run script to run some scenarios, you need:

  • to build go build -o bin/chess cmd/cli/*.go
  • to run ./bin/chess

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published