protected int count_mobility(ChessType[] board, ChessType color) { ChessType oppcolor = 2 - color; int mobility; Empties em; mobility = 0; for (em = EmHead.Succ; em != null; em = em.Succ) { if (RuleUtils.AnyFlips(board, em.Square, color, oppcolor)) { mobility++; } } return(mobility); }
public int MidEval2(ChessType[] board, ChessType color, ChessType oppcolor, int empties, Empties EmHead) { int eval = 0; // int mydisc = 0; int opdisc = 0; // int mymob = 0; int opmob = 0; // int mypotmob = 0; int oppotmob = 0; // int mystab = 0; int opstab = 0; // int deltakeyano = 0; // int unstab = 0; int sqnum; int index = empties - 10; Empties em = EmHead.Succ; for (; em != null; em = em.Succ) { sqnum = em.Square; if (RuleUtils.AnyFlips(board, sqnum, color, oppcolor)) { mymob++; } else if (RuleUtils.AnyPotMobility(board, sqnum, oppcolor)) { mypotmob++; } if (RuleUtils.AnyFlips(board, sqnum, oppcolor, color)) { opmob++; } else if (RuleUtils.AnyPotMobility(board, sqnum, color)) { oppotmob++; } } for (int i = 0; i < midBoardLength; i++) { sqnum = midBoard[i]; if (board[sqnum] == color) { mydisc++; if (RuleUtils.AnyStab(board, sqnum, color)) { mystab++; } } else if (board[sqnum] == oppcolor) { opdisc++; if (RuleUtils.AnyStab(board, sqnum, oppcolor)) { opstab++; } } } deltakeyano = getDeltaKeyano(board, color, oppcolor); unstab = getUnStab(board, color) - getUnStab(board, oppcolor); eval = mydisc * weight_train[index, 0] + opdisc * weight_train[index, 1] + mymob * weight_train[index, 2] + opmob * weight_train[index, 3] + mypotmob * weight_train[index, 4] + oppotmob * weight_train[index, 5] + mystab * weight_train[index, 6] + opstab * weight_train[index, 7] + unstab * weight_train[index, 8] + deltakeyano * weight_train[index, 9]; eval += get_score_edge_all(board, color, index) / 3; return(eval); }