Skip to content
GitLab
About GitLab
GitLab: the DevOps platform
Explore GitLab
Install GitLab
How GitLab compares
Get started
GitLab docs
GitLab Learn
Pricing
Talk to an expert
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Projects
Groups
Snippets
Sign up now
Login
Sign in
Toggle navigation
Menu
Open sidebar
jabapo
pp-chess
Commits
0b74239a
Commit
0b74239a
authored
Jul 05, 2021
by
jabapo
Browse files
knight works
parent
dd5b387e
Changes
2
Hide whitespace changes
Inline
Side-by-side
game.cpp
View file @
0b74239a
...
...
@@ -194,7 +194,7 @@ class Game{
}
}
else
if
(
p
.
t
==
Type
::
Knight
){
return
((
abs
(
startr
-
endr
)
==
1
&&
abs
(
startc
-
endc
)
==
3
)
||
(
abs
(
startr
-
endr
)
==
3
&&
abs
(
startc
-
endc
)
==
1
));
return
((
abs
(
startr
-
endr
)
==
1
&&
abs
(
startc
-
endc
)
==
2
)
||
(
abs
(
startr
-
endr
)
==
2
&&
abs
(
startc
-
endc
)
==
1
));
}
else
if
(
p
.
t
==
Type
::
Queen
){
//should be easier, just add checks from rook and bishop into one
...
...
@@ -410,7 +410,6 @@ class Game{
}
void
DisplayChecks
(){
char
l
=
'a'
;
for
(
int
i
=
8
;
i
>
0
;
i
--
){
for
(
int
j
=
0
;
j
<
8
;
j
++
){
std
::
cout
<<
kingchecks
[
j
][
i
-
1
].
first
;
...
...
@@ -437,7 +436,7 @@ class Game{
int
whitemoves
=
0
;
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>
movelist
;
std
::
pair
<
Whitecheck
,
Blackcheck
>
kingchecks
[
8
][
8
];
std
::
pair
<
int
,
int
>
knighttrasnformations
[
8
]
=
{{
3
,
1
},{
3
,
-
1
},{
1
,
3
},{
1
,
-
3
},{
-
3
,
1
},{
-
3
,
-
1
},{
-
1
,
-
3
},{
-
1
,
3
}};
std
::
pair
<
int
,
int
>
knighttrasnformations
[
8
]
=
{{
2
,
1
},{
2
,
-
1
},{
1
,
2
},{
1
,
-
2
},{
-
2
,
1
},{
-
2
,
-
1
},{
-
1
,
-
2
},{
-
1
,
2
}};
std
::
pair
<
int
,
int
>
bishoptransformations
[
4
]
=
{{
7
,
7
},{
7
,
-
7
},{
-
7
,
7
},{
-
7
,
-
7
}};
std
::
pair
<
int
,
int
>
rooktransformations
[
4
]
=
{{
7
,
0
},{
0
,
-
7
},{
-
7
,
0
},{
0
,
7
}};
//R: If last three moves are replicates, game ends in a draw
...
...
tests.cpp
deleted
100644 → 0
View file @
dd5b387e
#include
<string>
#include
<cassert>
#include
<vector>
#include
<algorithm>
#include
<iostream>
#include
<fstream>
#include
<deque>
#include
<sstream>
#include
"board.cpp"
void
BishopEmptyTest
(){
tiles
[
0
][
0
].
occupied
=
true
;
tiles
[
0
][
0
].
p
.
c
=
Color
::
White
;
tiles
[
0
][
0
].
p
.
t
=
Type
::
Bishop
;
tiles
[
0
][
0
].
p
.
row
=
0
;
tiles
[
0
][
0
].
p
.
col
=
0
;
tiles
[
0
][
1
].
occupied
=
true
;
tiles
[
0
][
1
].
p
.
c
=
Color
::
White
;
tiles
[
0
][
1
].
p
.
t
=
Type
::
Bishop
;
tiles
[
0
][
1
].
p
.
row
=
1
;
tiles
[
0
][
1
].
p
.
col
=
1
;
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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