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
c0a53356
Commit
c0a53356
authored
9 years ago
by
Gaste Adrien
Browse files
Options
Downloads
Patches
Plain Diff
Implemented play function
parent
2206bbd9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/game/morpion.cpp
+10
-1
10 additions, 1 deletion
src/game/morpion.cpp
src/game/morpion.hpp
+1
-0
1 addition, 0 deletions
src/game/morpion.hpp
with
11 additions
and
1 deletion
src/game/morpion.cpp
+
10
−
1
View file @
c0a53356
...
...
@@ -121,7 +121,16 @@ namespace game
void
morpion
::
play
(
uint16_t
m
)
{
uint16_t
bitboard
=
state
.
cross_bitboard
|
state
.
circle_bitboard
;
uint16_t
position
=
(
state
.
possible_moves
>>
4
*
m
)
&
15
;
//15 is the mask to get only one move
if
(
current_player
()
==
CROSS
)
state
.
cross_bitboard
+=
1
<<
position
;
else
state
.
circle_bitboard
+=
1
<<
position
;
//State update
state
.
total_moves
++
;
update_win
();
update_moves
();
return
;
}
...
...
This diff is collapsed.
Click to expand it.
src/game/morpion.hpp
+
1
−
0
View file @
c0a53356
...
...
@@ -14,6 +14,7 @@ namespace game
uint16_t
cross_bitboard
=
0
;
//bitboard with the played moves of the cross
uint16_t
circle_bitboard
=
0
;
//bitboard with the played moves of the circle
uint8_t
total_moves
=
0
;
//Total played moves (<= 9)
uint64_t
possible_moves
=
0x876543210
;
//List of possible moves left
bool
first_player_win
=
false
;
//First player is always the cross
bool
second_player_win
=
false
;
//Second player is always the circle
};
...
...
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