Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pingouins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bariatti Francesco
pingouins
Commits
dedcfde9
Commit
dedcfde9
authored
9 years ago
by
Le Mikael
Browse files
Options
Downloads
Patches
Plain Diff
mod 2 mika
parent
23074505
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/game/morpion.cpp
+9
-7
9 additions, 7 deletions
src/game/morpion.cpp
with
9 additions
and
7 deletions
src/game/morpion.cpp
+
9
−
7
View file @
dedcfde9
...
...
@@ -68,7 +68,7 @@ namespace game
uint8_t
morpion
::
current_player
()
const
{
return
state
.
total_moves
&
1
?
CIRCLE
:
CROSS
;
// CROSS even, CIRCLE odd
}
}
int
morpion
::
value
(
uint8_t
player
)
const
{
...
...
@@ -99,11 +99,11 @@ namespace game
bool
morpion
::
has_won
(
uint16_t
bitboard
)
{
if
(
bitboard
==
ROW1_MASK
||
bitboard
==
ROW2_MASK
||
bitboard
==
ROW3_MASK
)
// Check vertical |
if
(
bitboard
==
ROW0_MASK
||
bitboard
==
ROW1_MASK
||
bitboard
==
ROW2_MASK
)
// Check vertical |
return
true
;
if
(
bitboard
==
COL1_MASK
||
bitboard
==
COL2_MASK
||
bitboard
==
COL3_MASK
)
// Check horizontal _
if
(
bitboard
==
COL0_MASK
||
bitboard
==
COL1_MASK
||
bitboard
==
COL2_MASK
)
// Check horizontal _
return
true
;
if
(
bitboard
==
DIA
1
_MASK
||
bitboard
==
DIA
2
_MASK
)
// Chack diagonal \ /
if
(
bitboard
==
DIA
0
_MASK
||
bitboard
==
DIA
1
_MASK
)
// Chack diagonal \ /
return
true
;
return
false
;
}
...
...
@@ -113,9 +113,11 @@ namespace game
//TODO: Implement
}
void
morpion
::
play
(
uint16_t
m
)
{
//TODO: Implement
void
morpion
::
play
(
uint16_t
m
)
// not finished
{
uint16_t
bitboard
=
cross_bitboard
|
circle_bitboard
;
if
(
current_player
()
==
CROSS
)
}
string
morpion
::
player_to_string
(
uint8_t
player
)
const
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment