Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
AlaskaLinuxUser
picoEngine
Commits
73b61cae
Commit
73b61cae
authored
Mar 12, 2019
by
alaskalinuxuser
Browse files
Fixed FEN + Moves
parent
74ad99d8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
10 deletions
+81
-10
Board.cpp
Board.cpp
+81
-10
board.o
board.o
+0
-0
picoEngine
picoEngine
+0
-0
No files found.
Board.cpp
View file @
73b61cae
...
...
@@ -43,10 +43,17 @@ vector<string> sepVect = split(boardPositions, ' ');
else
if
(
isalpha
(
myChar
))
{
stringBoard
=
stringBoard
+
myChar
;
}
}
// end for.
int
j
=
stringBoard
.
length
();
for
(
int
i
=
0
;
i
<
j
;
i
++
)
{
if
(
i
<
64
){
m_theBoard
[
63
-
i
]
=
stringBoard
.
at
(
i
);
}
}
cout
<<
stringBoard
<<
endl
;
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
m_theBoard
[
i
+
0
]
=
stringBoard
.
at
(
i
+
56
);
m_theBoard
[
i
+
8
]
=
stringBoard
.
at
(
i
+
48
);
m_theBoard
[
i
+
16
]
=
stringBoard
.
at
(
i
+
40
);
m_theBoard
[
i
+
24
]
=
stringBoard
.
at
(
i
+
32
);
m_theBoard
[
i
+
32
]
=
stringBoard
.
at
(
i
+
24
);
m_theBoard
[
i
+
40
]
=
stringBoard
.
at
(
i
+
16
);
m_theBoard
[
i
+
48
]
=
stringBoard
.
at
(
i
+
8
);
m_theBoard
[
i
+
56
]
=
stringBoard
.
at
(
i
+
0
);
}
if
(
sepVect
[
3
].
at
(
0
)
==
'w'
)
{
m_whitesTurn
=
true
;
}
else
{
m_whitesTurn
=
false
;
}
...
...
@@ -64,15 +71,58 @@ vector<string> sepVect = split(boardPositions, ' ');
{
m_enPassant
=
false
;}
else
{
m_enPassant
=
true
;}
m_moveSince
=
stoi
(
sepVect
[
6
]);
m_turnCount
=
stoi
(
sepVect
[
7
]);
/* If also has moves after fen....
if (sepVect.size() > 7) {
if (sepVect[8] == "moves"){
cout << "moves" << endl;
int l = sepVect.size();
// If also has moves after fen....
if
(
sepVect
.
size
()
>
8
)
{
if
(
sepVect
[
8
].
at
(
0
)
==
'm'
){
int
l
=
sepVect
.
size
();
for
(
int
k
=
9
;
k
<
l
;
k
++
)
{
int
first
=
((
sepVect
[
k
].
at
(
0
)
-
'a'
+
1
)
+
(((
sepVect
[
k
].
at
(
1
)
-
'1'
)
*
8
)
-
1
));
int
second
=
((
sepVect
[
k
].
at
(
2
)
-
'a'
+
1
)
+
(((
sepVect
[
k
].
at
(
3
)
-
'1'
)
*
8
)
-
1
));
m_theBoard
[
second
]
=
m_theBoard
[
first
];
if
(
m_enPassant
){
if
(
m_theBoard
[
second
]
==
'p'
&&
sepVect
[
k
].
at
(
1
)
==
'4'
){
if
((
sepVect
[
k
].
at
(
1
)
-
sepVect
[
k
].
at
(
3
))
==
1
){
if
((
sepVect
[
k
].
at
(
2
)
-
sepVect
[
k
].
at
(
0
))
==
1
){
m_theBoard
[
first
-
1
]
=
'-'
;
}}
if
((
sepVect
[
k
].
at
(
1
)
-
sepVect
[
k
].
at
(
3
))
==
1
){
if
((
sepVect
[
k
].
at
(
0
)
-
sepVect
[
k
].
at
(
2
))
==
1
){
m_theBoard
[
first
+
1
]
=
'-'
;
}}
//cout << "EN PASSANT" << endl;
}
if
(
m_theBoard
[
second
]
==
'P'
&&
sepVect
[
k
].
at
(
1
)
==
'5'
){
if
((
sepVect
[
k
].
at
(
3
)
-
sepVect
[
k
].
at
(
1
))
==
1
){
if
((
sepVect
[
k
].
at
(
2
)
-
sepVect
[
k
].
at
(
0
))
==
1
){
m_theBoard
[
first
+
1
]
=
'-'
;
}}
if
((
sepVect
[
k
].
at
(
3
)
-
sepVect
[
k
].
at
(
1
))
==
1
){
if
((
sepVect
[
k
].
at
(
0
)
-
sepVect
[
k
].
at
(
2
))
==
1
){
m_theBoard
[
first
-
1
]
=
'-'
;
}}
//cout << "EN PASSANT" << endl;
}
}
// End checking en passant.
m_enPassant
=
false
;
m_enPasPawn
=
' '
;
// EN PASSANT enabled
if
(
m_theBoard
[
second
]
==
'p'
){
if
((
sepVect
[
k
].
at
(
1
)
-
sepVect
[
k
].
at
(
3
))
==
2
){
m_enPassant
=
true
;
m_enPasPawn
=
sepVect
[
k
].
at
(
2
);
//cout << "EN PASSANT enabled " << m_enPasPawn << endl;
}
}
if
(
m_theBoard
[
second
]
==
'P'
){
if
((
sepVect
[
k
].
at
(
3
)
-
sepVect
[
k
].
at
(
1
))
==
2
){
m_enPassant
=
true
;
m_enPasPawn
=
sepVect
[
k
].
at
(
2
);
//cout << "EN PASSANT enabled " << m_enPasPawn << endl;
}
}
// End EN PASSANT enabled
if
(
sepVect
[
k
].
size
()
==
5
)
{
char
newPiece
=
'-'
;
if
(
!
m_whitesTurn
)
{
...
...
@@ -82,6 +132,27 @@ vector<string> sepVect = split(boardPositions, ' ');
}
m_theBoard
[
second
]
=
newPiece
;
}
if
(
m_theBoard
[
first
]
==
'k'
||
m_theBoard
[
first
]
==
'K'
){
//cout << "King Move" << endl;
if
(
first
==
4
&&
second
==
6
)
{
// White Castles King Side
m_theBoard
[
7
]
=
'-'
;
m_theBoard
[
5
]
=
'R'
;
//cout << "castleWKS" << endl;
}
else
if
(
first
==
4
&&
second
==
2
)
{
// White Castles Queen Side
m_theBoard
[
0
]
=
'-'
;
m_theBoard
[
3
]
=
'R'
;
//cout << "castleWQS" << endl;
}
else
if
(
first
==
60
&&
second
==
62
)
{
// Black Castles King Side
m_theBoard
[
63
]
=
'-'
;
m_theBoard
[
61
]
=
'r'
;
//cout << "castleBKS" << endl;
}
else
if
(
first
==
60
&&
second
==
58
)
{
// Black Castles Queen Side
m_theBoard
[
56
]
=
'-'
;
m_theBoard
[
59
]
=
'r'
;
//cout << "castleBQS" << endl;
}
}
// Not a king move.....
m_theBoard
[
first
]
=
'-'
;
if
(
first
==
4
)
{
m_Kcastle
=
false
;
m_Qcastle
=
false
;}
if
(
first
==
60
)
{
m_kcastle
=
false
;
m_qcastle
=
false
;}
...
...
@@ -90,7 +161,7 @@ vector<string> sepVect = split(boardPositions, ' ');
m_turnCount
=
k
/
2
-
0.5
;
}
}
// end moves setup.
}// end
greater than 7 vectors. */
}
// end
FEN and MOVES.
cout
<<
"Position Set...."
<<
endl
;
}
// End FEN
else
if
(
sepVect
[
1
]
==
"startpos"
)
...
...
board.o
View file @
73b61cae
No preview for this file type
picoEngine
View file @
73b61cae
No preview for this file type
AlaskaLinuxUser
@alaskalinuxuser
mentioned in issue
#5 (closed)
·
Mar 12, 2019
mentioned in issue
#5 (closed)
mentioned in issue #5
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment