-
Notifications
You must be signed in to change notification settings - Fork 0
/
moveGen.hpp
84 lines (51 loc) · 2.14 KB
/
moveGen.hpp
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//
// moveGen.hpp
// Chess Engine
//
// Created by Blake Johnson on 2/4/19.
// Copyright © 2019 Blake Johnson. All rights reserved.
//
#ifndef moveGen_hpp
#define moveGen_hpp
#include <stdio.h>
#include "types.hpp"
#include "bitboard.hpp"
#include "position.hpp"
class position;
enum moveType {
quiet,
capture,
evasion
};
struct candidate {
move mv;
int value;
};
struct candMoveList {
candidate* end = moveList;
candidate* start = moveList;
candidate moveList[256];
};
template <moveType>
candidate* generate (const position& pos, candidate* moveList);
candidate* generateLegal (const position& pos, candidate* moveList, moveType T);
candidate* generateNonEvasions(const position& pos, candidate* moveList);
candidate* generateAllLegal (const position& pos, candidate* moveList);
candidate* generateQuiet (const position& pos, candidate* moveList);
candidate* generateCapture (const position& pos, candidate* moveList);
candidate* generatePromotions (const position& pos, candidate* moveList);
candidate* generateEvasion (const position& pos, candidate* moveList);
candidate* generateCastling (const position& pos, candidate* moveList); //Generates Legal Moves
candidate* generateEnPassent (const position& pos, candidate* moveList);
candidate* makePromotionMoves (square from, square to, candidate* moveList);
//bitboard target can dictate which whether a move will be a capture or not
candidate* knightMoves (bitboard knights, bitboard target, candidate* moveList);
candidate* pawnPushMoves (const position& pos, bitboard pawns, player color, bitboard target, candidate* moveList);
candidate* pawnAttackMoves (bitboard pawns, player color, bitboard target, candidate* moveList);
//for king moves, get the masks for the kings and xor them so that they cant be a square apart
candidate* kingMoves (const position& pos, bitboard target, candidate* moveList);
//bitboard sliderAttacks (square sq, bitboard occupency, pieceType pt)
candidate* sliderMoves (const position& pos, bitboard target ,candidate* moveList);
void printmove (move m);
void printMoves (candidate* start, candidate* end);
#endif /* moveGen_hpp */