diff options
Diffstat (limited to 'FICS/formula.c')
-rw-r--r-- | FICS/formula.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/FICS/formula.c b/FICS/formula.c index 033d145..4315239 100644 --- a/FICS/formula.c +++ b/FICS/formula.c @@ -112,32 +112,33 @@ int GetNumberInsideParens (game *g, int clause, int *i, int *token, else return (ERR_PAREN); } -int Maxtime (game *g, int numMoves, int numPlayers) +int +Maxtime(game *g, int numMoves, int numPlayers) { - int max; - - if ((g->bInitTime == g->wInitTime) && (g->bIncrement == g->wIncrement)) { - max = numPlayers * (60 * g->wInitTime + numMoves * g->wIncrement); - if ((g->type != TYPE_UNTIMED) && (g->wInitTime == 0)) - max +=10 * numPlayers; /* 0 x start with ten secs */ - - } else if (numPlayers == 2) { - max = 60 * (g->wInitTime + g->bInitTime) - + numMoves * (g->wIncrement + g->bIncrement); - if ((g->type != TYPE_UNTIMED) && (g->wInitTime == 0)) - max +=10; /* 0 x start with ten secs */ - if ((g->type != TYPE_UNTIMED) && (g->bInitTime == 0)) - max +=10; /* 0 x start with ten secs */ - - } else { - max = 60 * g->bInitTime + numMoves * g->bIncrement; - if ((g->type != TYPE_UNTIMED) && (g->bInitTime == 0)) - max +=10; /* 0 x start with ten secs */ - } - - return max; -} + int max; + + if (g->bInitTime == g->wInitTime && g->bIncrement == g->wIncrement) { + max = numPlayers * (60 * g->wInitTime + numMoves * + g->wIncrement); + + if (g->type != TYPE_UNTIMED && g->wInitTime == 0) + max += (10 * numPlayers); + } else if (numPlayers == 2) { + max = 60 * (g->wInitTime + g->bInitTime) + numMoves * + (g->wIncrement + g->bIncrement); + + if (g->type != TYPE_UNTIMED && g->wInitTime == 0) + max += 10; + if (g->type != TYPE_UNTIMED && g->bInitTime == 0) + max += 10; + } else { + max = (60 * g->bInitTime + numMoves * g->bIncrement); + if (g->type != TYPE_UNTIMED && g->bInitTime == 0) + max += 10; + } + return max; +} /* * The black player in game 'g' has been challenged. S/he has a list |