Skip to content

arnilsenarthur/2aCE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2aCE - Árnilsen's Adaptable Chess Engine

2aCE is a chess engine in development, created for standard and custom chess game modes. Created by Árnilsen Arthur in 2021, using bitboard method in C++

Features

  • Very Fast/Optmized
  • Bitboard (8x8 and 16x16)
  • Rays optmization (8x8 and 16x16)
  • Standard test Mode (8x8)
    • Legal move generation
      • En Passant
      • Castling
    • Random plays
    • FEN load/save
    • PGN Move parsing/stringifier
  • Test mode (16x16)

Future Targets

  • 16x16 board size limit (For custom games like 2x2 players)
  • Team support
  • AI system
  • Game analysis
  • UCI Support

Simple Usage Example

//Create standard chess board (8x8, White x Black)
StandardBoard board;

std::string status;
//Parse Move
Move mv = board.parseMove("c4",status);
if(mv.isValid())
{
    //Do Move
    board.doMove(mv);
    board.print();
}
else
    //Print what is wrong
    cout << status;

I/O

For now, 2aCE don't support UCI, but you can use built methods to test engine. All the outputs are also formatted as you can see bellow:

Bitboard bitboard = ...;
bitboard.print();

//8x8
0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0

//16x16
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
StandardBoard board = ...;
board.print();

8 r n b q k b n r
7 p p p p p p p p
6 . . . . . . . .
5 . . . . . . . .
4 . . . . . . . .
3 . . . . . . . .
2 P P P P P P P P
1 R N B Q K B N R
  a b c d e f g h

Performance

Version 1.0.0

Performance Test code:

//Create board
StandardBoard board;

//Seed
srand (time(NULL));
auto start  = chrono::steady_clock::now();

//Do n random moves
for(int i = 0; i < n; i ++)
{
    board.genMoves();
  
    if(board.legalMoves.size() == 0)
    {
        cout << "Break: " << i;
  	    break;
    }

    Move mv = board.legalMoves[rand() % board.legalMoves.size()];
    board.doMove(mv);
}

//Finalize, print elapsed time and moves    
auto end  = chrono::steady_clock::now();
cout <<" Test ended in " << chrono::duration_cast<chrono::microseconds>(end - start).count()/1000.0 << "ms" << endl;
Moves Tests Average (ms) Min (ms) Max (ms)
1 10 0.038 0.03 0.072
100 10 0.945 0.845 1.232
500000 10 1258.606 1184.92 1391.27

About

Arnilsen's Adaptable Chess Engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages