-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
71 lines (54 loc) · 1.44 KB
/
Copy pathmain.cpp
File metadata and controls
71 lines (54 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <iostream>
#include <math.h>
#include "Constants.h"
#include "Game.h"
#include <bitset>
#include <string>
using namespace std;
const char pieces[13]="RNBQKPrnbqkp";
void print_board(unsigned long long *board){
char board_sting[65];
bool unchecked[64];
for (bool & i : unchecked) {
i=true;
}
for(int i=0;i<12;i++) {
for (int j=0;j<64;j++) {
if((board[i] & (1ULL << j)) == (1ULL << j)) {
board_sting[j]=pieces[i];
unchecked[j]=false;
}
}
}
board_sting[64]='\0';
for (int i=0;i<64;i++) {
if (unchecked[i]) {
board_sting[i]='+';
}
}
for (int rank=7;rank>=0;rank--) {
for (int file=0;file<8;file++) {
cout << board_sting[rank*8+file] << " ";
}
cout << endl;
}
cout<<endl;
}
int main() {
unsigned long long board[12];
for (int i=0;i<12;i++) {
board[i]=STARTING_BOARD[i];
cout<<bitset<64>(board[i])<<endl;
}
Game game(board);
print_board(game.Board());
game.move("e4");
print_board(game.Board());
game.move("e5");
print_board(game.Board());
game.move("Nf3"); print_board(game.Board());
game.move("Nc6"); print_board(game.Board());
game.move("Bb5"); print_board(game.Board());
game.move("f5"); print_board(game.Board());
game.move("exf5"); print_board(game.Board());
}