Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Emil
ste6274 template source base
Commits
4c4ad0f5
Commit
4c4ad0f5
authored
Oct 07, 2019
by
Emil
Browse files
Update to utility (normal moves vorking, not jumps)
parent
e0eaa84d
Changes
1
Hide whitespace changes
Inline
Side-by-side
libs/engine/source/utility.cpp
View file @
4c4ad0f5
...
...
@@ -103,24 +103,30 @@ namespace gameengine::utility
Moves
new_moves
{};
Moves
new_jumps
{};
BitPieces
East
;
BitPieces
East_jump1
;
BitPieces
East_jump
;
BitPieces
West
;
BitPieces
West_jump
;
BitPieces
West_jump1
;
BitPieces
mask
=
MaskCheck
;
BitPieces
unoccupied
=
~
occupiedPositions
(
board
);
// Masks for player One (simple moves and jumps)
// Masks for player One (simple moves and jumps
(north)
)
if
(
player_id
==
PlayerId
::
One
)
{
East
=
(
unoccupied
&
MaskEast
)
>>
9
&
occupiedPosition
(
board
,
player_id
);
East_jump
=
((
unoccupied
&
MaskEast
)
>>
9
&
occupiedPosition
(
board
,
PlayerId
::
Two
))
&
(((((
unoccupied
&
MaskEast
)
>>
9
)
&
occupiedPosition
(
board
,
PlayerId
::
Two
))
>>
9
)
&
occupiedPosition
(
board
,
player_id
));
East_jump1
=
((
unoccupied
&
MaskEast
)
>>
9
);
East_jump
=
((
East_jump1
&
(
occupiedPosition
(
board
,
PlayerId
::
Two
)))
>>
9
)
&
occupiedPosition
(
board
,
player_id
);
West
=
(
unoccupied
&
MaskWest
)
>>
7
&
occupiedPosition
(
board
,
player_id
);
West_jump
=
((
unoccupied
&
MaskWest
)
>>
7
&
occupiedPosition
(
board
,
PlayerId
::
Two
))
&
(((((
unoccupied
&
MaskWest
)
>>
7
)
&
occupiedPosition
(
board
,
PlayerId
::
Two
))
>>
7
)
&
occupiedPosition
(
board
,
player_id
));
West_jump1
=
((
unoccupied
&
MaskWest
)
>>
7
);
West_jump
=
((
West_jump1
&
(
occupiedPosition
(
board
,
PlayerId
::
Two
)))
>>
7
)
&
occupiedPosition
(
board
,
player_id
);
}
// Masks for player Two (simple moves and jumps)
// Masks for player Two (simple moves and jumps
(south)
)
else
{
East
=
(
unoccupied
&
MaskEast
)
<<
7
&
occupiedPosition
(
board
,
player_id
);
East_jump
=
((
unoccupied
&
MaskEast
)
<<
7
&
occupiedPosition
(
board
,
PlayerId
::
One
))
&
(((((
unoccupied
&
MaskEast
)
<<
7
)
&
occupiedPosition
(
board
,
PlayerId
::
One
))
<<
7
)
&
occupiedPosition
(
board
,
player_id
));
East_jump1
=
((
unoccupied
&
MaskEast
)
<<
7
);
East_jump
=
((
East_jump1
&
(
occupiedPosition
(
board
,
PlayerId
::
One
)))
<<
7
)
&
occupiedPosition
(
board
,
player_id
);
West
=
(
unoccupied
&
MaskWest
)
<<
9
&
occupiedPosition
(
board
,
player_id
);
West_jump
=
((
unoccupied
&
MaskWest
)
<<
9
&
occupiedPosition
(
board
,
PlayerId
::
One
))
&
(((((
unoccupied
&
MaskWest
)
<<
9
)
&
occupiedPosition
(
board
,
PlayerId
::
One
))
<<
9
)
&
occupiedPosition
(
board
,
player_id
));
West_jump1
=
((
unoccupied
&
MaskWest
)
<<
9
);
West_jump
=
((
West_jump1
&
(
occupiedPosition
(
board
,
PlayerId
::
One
)))
<<
9
)
&
occupiedPosition
(
board
,
player_id
);
}
// if there is no jumps, then simple moves are legal
if
(
East_jump
.
none
()
&&
West_jump
.
none
()){
...
...
Write
Preview
Supports
Markdown
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