private void moveCheckerIntoFreeNest(Nest clickedNest, Checker remCh, Player player, Nest nextNest) { if (player.checkers.Contains(remCh)) { if (clickedNest != null) { clickedNest.Checkers.Remove(remCh); } if (targetNestContainsMoreThanOneOpponentsChecker(nextNest, player)) { return; } else if (targetNestContainsNOopponentsChecker(nextNest, player)) { nextNest.addChecker(remCh); if (clickedNest != null) { player.checkers_addTo_removeFrom_Home(clickedNest, remCh, gameBoard.Nests); } } } }
protected void setInitialCheckerState(Player l1, Player pl2) { List <Checker> pl1Checkers = player1.checkers; List <Checker> pl2Checkers = pl2.checkers; foreach (Nest n in gameBoard.Nests) { if (n.paleyerNestID == 1) { for (int i = 0; i < pl1Checkers.Count; i++) { if (i < 2) { Checker myChecker = pl1Checkers[i]; n.addChecker(myChecker); l1.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } if (n.paleyerNestID == 12) { for (int i = 2; i < pl1Checkers.Count; i++) { if (i < 7) { Checker myChecker = pl1Checkers[i]; n.addChecker(myChecker); l1.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } if (n.paleyerNestID == 17) { for (int i = 7; i < pl1Checkers.Count; i++) { if (i < 10) { Checker myChecker = pl1Checkers[i]; n.addChecker(myChecker); l1.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } if (n.paleyerNestID == 19) { for (int i = 10; i < pl1Checkers.Count; i++) { if (i < 15) { Checker myChecker = pl1Checkers[i]; n.addChecker(myChecker); l1.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } //OPPONENT if (n.opponentNestID == 1) { for (int i = 0; i < pl2Checkers.Count; i++) { if (i < 2) { Checker myChecker = pl2Checkers[i]; n.addChecker(myChecker); pl2.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } if (n.opponentNestID == 12) { for (int i = 2; i < pl2Checkers.Count; i++) { if (i < 7) { Checker myChecker = pl2Checkers[i]; n.addChecker(myChecker); pl2.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } if (n.opponentNestID == 17) { for (int i = 7; i < pl2Checkers.Count; i++) { if (i < 10) { Checker myChecker = pl2Checkers[i]; n.addChecker(myChecker); pl2.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } if (n.opponentNestID == 19) { for (int i = 10; i < pl2Checkers.Count; i++) { if (i < 15) { Checker myChecker = pl2Checkers[i]; n.addChecker(myChecker); pl2.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } } }
private void moveCheckerIntoFreeNest(Nest clickedNest, Checker remCh, Player player, Nest nextNest) { if (player.checkers.Contains(remCh)) { if(clickedNest != null) clickedNest.Checkers.Remove(remCh); if (targetNestContainsMoreThanOneOpponentsChecker(nextNest, player)) { return; } else if (targetNestContainsNOopponentsChecker(nextNest, player)) { nextNest.addChecker(remCh); if (clickedNest != null) player.checkers_addTo_removeFrom_Home(clickedNest, remCh, gameBoard.Nests); } } }
protected void setInitialCheckerState(Player l1, Player pl2) { List<Checker> pl1Checkers = player1.checkers; List<Checker> pl2Checkers = pl2.checkers; foreach (Nest n in gameBoard.Nests) { if (n.paleyerNestID == 1) { for (int i = 0; i < pl1Checkers.Count; i++) { if (i < 2) { Checker myChecker = pl1Checkers[i]; n.addChecker(myChecker); l1.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } if (n.paleyerNestID == 12) { for (int i = 2; i < pl1Checkers.Count; i++) { if (i < 7) { Checker myChecker = pl1Checkers[i]; n.addChecker(myChecker); l1.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } if (n.paleyerNestID == 17) { for (int i = 7; i < pl1Checkers.Count; i++) { if (i < 10) { Checker myChecker = pl1Checkers[i]; n.addChecker(myChecker); l1.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } if (n.paleyerNestID == 19) { for (int i = 10; i < pl1Checkers.Count; i++) { if (i < 15) { Checker myChecker = pl1Checkers[i]; n.addChecker(myChecker); l1.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } //OPPONENT if (n.opponentNestID == 1) { for (int i = 0; i < pl2Checkers.Count; i++) { if (i < 2) { Checker myChecker = pl2Checkers[i]; n.addChecker(myChecker); pl2.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } if (n.opponentNestID == 12) { for (int i = 2; i < pl2Checkers.Count; i++) { if (i < 7) { Checker myChecker = pl2Checkers[i]; n.addChecker(myChecker); pl2.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } if (n.opponentNestID == 17) { for (int i = 7; i < pl2Checkers.Count; i++) { if (i < 10) { Checker myChecker = pl2Checkers[i]; n.addChecker(myChecker); pl2.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } if (n.opponentNestID == 19) { for (int i = 10; i < pl2Checkers.Count; i++) { if (i < 15) { Checker myChecker = pl2Checkers[i]; n.addChecker(myChecker); pl2.checkers_addTo_removeFrom_Home(n, myChecker, gameBoard.Nests); } } } } }