little correction for #12 Add tournament rules to prevent a game from lasting too long due to ties
This commit is contained in:
parent
d28d9e96a1
commit
ac73f34045
2 changed files with 8 additions and 18 deletions
|
|
@ -147,9 +147,9 @@ namespace graphene { namespace chain {
|
|||
{
|
||||
void clear_next_timeout(database& db, game_object& game)
|
||||
{
|
||||
const match_object& match_obj = game.match_id(db);
|
||||
const tournament_object& tournament_obj = match_obj.tournament_id(db);
|
||||
const rock_paper_scissors_game_options& game_options = tournament_obj.options.game_options.get<rock_paper_scissors_game_options>();
|
||||
//const match_object& match_obj = game.match_id(db);
|
||||
//const tournament_object& tournament_obj = match_obj.tournament_id(db);
|
||||
//const rock_paper_scissors_game_options& game_options = tournament_obj.options.game_options.get<rock_paper_scissors_game_options>();
|
||||
game.next_timeout = fc::optional<fc::time_point_sec>();
|
||||
}
|
||||
void on_entry(const timeout& event, game_state_machine_& fsm)
|
||||
|
|
@ -451,17 +451,8 @@ namespace graphene { namespace chain {
|
|||
const match_object& match_obj = match_id(db);
|
||||
const tournament_object& tournament_obj = match_obj.tournament_id(db);
|
||||
const rock_paper_scissors_game_options& game_options = tournament_obj.options.game_options.get<rock_paper_scissors_game_options>();
|
||||
if (!game_options.insurance_enabled) // no automatic moves
|
||||
{
|
||||
struct rock_paper_scissors_throw_reveal reveal;
|
||||
reveal.nonce2 = 0;
|
||||
reveal.gesture = (rock_paper_scissors_gesture)db.get_random_bits(game_options.number_of_gestures);
|
||||
rps_game_details.reveal_moves[0] =
|
||||
rps_game_details.reveal_moves[1] = reveal;
|
||||
ilog("Both players failed to commit a move, generating a random move for them: ${gesture}",
|
||||
("gesture", reveal.gesture));
|
||||
}
|
||||
else
|
||||
|
||||
if (game_options.insurance_enabled)
|
||||
{
|
||||
for (unsigned i = 0; i < 2; ++i)
|
||||
{
|
||||
|
|
@ -514,9 +505,8 @@ namespace graphene { namespace chain {
|
|||
ilog("Player 0 didn't commit or reveal their move, player 1 wins");
|
||||
winners.insert(players[1]);
|
||||
}
|
||||
else // if (rps_game_details.reveal_moves[1])
|
||||
else
|
||||
{
|
||||
// should never reach this point ?
|
||||
ilog("Neither player made a move, both players lose");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,8 +124,7 @@ namespace graphene { namespace chain {
|
|||
}
|
||||
else
|
||||
{
|
||||
unsigned i = event.db.get_random_bits(match.players.size()-1);
|
||||
match.match_winners.insert(match.players[i]);
|
||||
match.match_winners.insert(match.players[event.db.get_random_bits(match.players.size())]);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -161,6 +160,7 @@ namespace graphene { namespace chain {
|
|||
|
||||
if (match_obj->games.size() >= tournament_obj.options.number_of_wins * 4)
|
||||
{
|
||||
wdump((match_obj->games.size()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue