diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-27 21:48:20 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-27 21:48:20 +0100 |
commit | fb3a67dfbb757a005d451907b9640de02a303380 (patch) | |
tree | 0ba1fdfd93cf9cfad610c96c7bf3221f72bd3769 /FICS/formula.c | |
parent | 2d6837125d08ccdf7a5eb3d57d172c6dfb87c386 (diff) |
Reformatted Maxtime()
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 |