Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F630187
command.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
command.cpp
View Options
#include
"game.h"
#include
"command.h"
//Command::Command()
//{
//}
Command
::
Command
(
efc
::
Game
&
currentGame
)
:
game
(
currentGame
)
{
// this->game = currentGame;
}
void
Command
::
removeDiamond
(
int
playerNumber
)
{
/*! This should works as following:
* - iterate over BoardDiamondSeq
* - find diamonds belonging to the playerNumber
* - create an array from the aboves
* - get a random element
* - remove from the board - set not active
*/
std
::
cout
<<
"removing diamond number "
<<
playerNumber
<<
std
::
endl
;
std
::
vector
<
int
>
diamonds
;
for
(
auto
&&
i
:
game
.
boardDiamonds
.
diamonds
)
{
int
fieldNumber
=
i
.
playerNumber
;
if
((
fieldNumber
==
playerNumber
)
&&
(
i
.
boardPosition
>
-1
)
&&
(
i
.
idNumber
==
4
))
{
std
::
cout
<<
"pushing found "
<<
fieldNumber
<<
std
::
endl
;
diamonds
.
push_back
(
i
.
boardPosition
);
}
}
int
numberDiamonds
=
diamonds
.
size
();
std
::
cout
<<
"found elements "
<<
numberDiamonds
<<
std
::
endl
;
if
(
numberDiamonds
>=
0
)
{
// std::cout << "pushing found " << fieldNumber << std::endl;
int
elemToRemove
=
rand
()
%
numberDiamonds
;
std
::
cout
<<
"random found "
<<
elemToRemove
<<
" "
<<
diamonds
[
elemToRemove
]
<<
std
::
endl
;
game
.
boardDiamonds
.
collectField
(
diamonds
[
elemToRemove
]);
}
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sun, Nov 15, 8:53 AM (6 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
149320
Default Alt Text
command.cpp (1 KB)
Attached To
Mode
R82 deerportal
Attached
Detach File
Event Timeline