-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpseudoCode.js
More file actions
50 lines (44 loc) · 1.3 KB
/
pseudoCode.js
File metadata and controls
50 lines (44 loc) · 1.3 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
// function getPotentialHorizontalOrVerticalMoves(
// currentBoard,
// currentPosition,
// maxMoves
// ) {
// // 1. Get the piece color
// // 2. Get all possible moves as four sub-arrays (maybe)
// // 3. Find break point of each of the sub-arrays and filter out anything after that point (take color into consideration)
// // 4. Return flat array of moves
// }
// // ROOK
// const potentialMoves = [
// ...getPotentialHorizontalOrVerticalMoves(
// currentBoard,
// currentPosition,
// Infinity
// )
// ];
// Nothing else
// BISHOP
// const potentialMoves = [
// ...getPotentialDiagonalMoves(currentBoard, currentPosition, Infinity)
// ];
// Nothing else
// QUEEN
// const potentialMoves = [
// ...getPotentialHorizontalOrVerticalMoves(
// currentBoard,
// currentPosition,
// Infinity
// ),
// ...getPotentialDiagonalMoves(currentBoard, currentPosition, Infinity)
// ];
// Nothing else
// KING
// const potentialMoves = [
// ...getPotentialHorizontalOrVerticalMoves(currentBoard, currentPosition, 1),
// ...getPotentialDiagonalMoves(currentBoard, currentPosition, 1)
// ];
// Some extra stuff for check
// KNIGHT
// Completely custom for now, but possibly refactor to be a bit more like the above
// PAWN
// Completely custom for now, but possibly refactor to be a bit more like the above