private void setNewGame() { resetGame(); desk.setPlayerPieces(rules.getInitPiecesWhite(), GameVar.PLAYER_WHITE); desk.setPlayerPieces(rules.getInitPiecesBlack(), GameVar.PLAYER_BLACK); desk.setCurrentPlayer(rules.getStartingPlayer()); setPlayerPieces(GameVar.PLAYER_WHITE, desk.getPlayerFields(GameVar.PLAYER_WHITE)); setPlayerPieces(GameVar.PLAYER_BLACK, desk.getPlayerFields(GameVar.PLAYER_BLACK)); setPlayerPcsCntLabel(GameVar.PLAYER_WHITE, desk.getPlayerFields(GameVar.PLAYER_WHITE).Count); setPlayerPcsCntLabel(GameVar.PLAYER_BLACK, desk.getPlayerFields(GameVar.PLAYER_BLACK).Count); }
private void startAIComputing(object sender, DoWorkEventArgs e) { // run ai with its own desk, while computing the desk is modified Desk aiDesk = new Desk(rules.getDeskSize(), rules.getPiecesPerPlayer()); aiDesk.setPlayerPieces(desk.getPlayerFields(GameVar.PLAYER_WHITE), GameVar.PLAYER_WHITE); aiDesk.setPlayerPieces(desk.getPlayerFields(GameVar.PLAYER_BLACK), GameVar.PLAYER_BLACK); aiDesk.setCurrentPlayer(desk.getCurrentPlayer()); aiMove = engine.getBestMove(aiDesk, rules); }