public static CBook ChooseOpponent(CBook book, CBook book1, CBook book2) { tourList.CountGames(book.name, book1.name, out int rw1, out int rl1, out int rd1); tourList.CountGames(book.name, book2.name, out int rw2, out int rl2, out int rd2); if ((book.GetElo() > book1.GetElo()) != (rw1 > rl1)) { return(book1); } if ((book.GetElo() > book2.GetElo()) != (rw2 > rl2)) { return(book2); } int count1 = (rw1 + rl1 + rd1); int count2 = (rw2 + rl2 + rd2); if (count1 * 1.1 <= count2 << 1) { return(book1); } if (count2 * 1.1 <= count1 >> 1) { return(book2); } return(null); }
public static void SetRepeition(CBook b, CBook o) { if ((book != b.name) || (opponent != o.name)) { book = b.name; opponent = o.name; SaveToIni(); tourList.CountGames(b.name, o.name, out int rw, out int rl, out _); if (games == 0) { repetition = b.tournament; if ((b.GetElo() > o.GetElo()) != (rw > rl)) { repetition++; } if (b.hisElo.list.Count < o.hisElo.list.Count) { repetition++; } rotate = true; } } games++; rotate ^= true; }