From fb3a67dfbb757a005d451907b9640de02a303380 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Wed, 27 Dec 2023 21:48:20 +0100 Subject: Reformatted Maxtime() --- FICS/formula.c | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'FICS') 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 -- cgit v1.2.3