public void shouldHaveMissileMiss() { BoatLocation location = new BoatLocation("A", "1", Orientation.X); player.SetOpponentBoatLocation(location); Assert.False(player.FireMissile("E", "1")); }
public void shouldHavePlayerLose() { BoatLocation location = new BoatLocation("A", "1", Orientation.Y); player.SetOpponentBoatLocation(location); Assert.False(player.HasWon()); }
public void shouldSetBoatLocations() { BoatLocation location = new BoatLocation("A", "1", Orientation.X); gameController.SetPlayerBoatLocation(location); Assert.Equal(location, gameController.GetPlayer2().GetOpponentBoatLocation()); }
public void shouldGetOpponentBoatLocation() { BoatLocation location = new BoatLocation("A", "1", Orientation.X); Assert.Equal(location.GetRow(), player.GetOpponentBoatLocation().GetRow()); Assert.Equal(location.GetColumn(), player.GetOpponentBoatLocation().GetColumn()); Assert.Equal(location.GetOrientation(), player.GetOpponentBoatLocation().GetOrientation()); }
public void shouldBeOnFireMissileAfterBoatSelection() { BoatLocation location = new BoatLocation("A", "1", Orientation.X); gameController.SetPlayerBoatLocation(location); gameController.SetPlayerBoatLocation(location); Assert.Equal(Stage.fireMissile, gameController.GetCurrentStage()); }
public void shouldBeOnPlayer2AfterFirstBoatSelection() { BoatLocation location = new BoatLocation("A", "1", Orientation.X); gameController.SetPlayerBoatLocation(location); Assert.Equal(gameController.GetPlayer2(), gameController.GetCurrentPlayer()); }
public void shouldRotateBoat() { BoatLocation location = new BoatLocation("A", "1", Orientation.Y); player.RotateBoat(); Assert.Equal(location.GetRow(), player.GetBoatLocation().GetRow()); Assert.Equal(location.GetColumn(), player.GetBoatLocation().GetColumn()); Assert.Equal(location.GetOrientation(), player.GetBoatLocation().GetOrientation()); }
public void shouldMoveBoatUp() { BoatLocation location = new BoatLocation("A", "8", Orientation.X); player.MoveBoatUp(); Assert.Equal(location.GetRow(), player.GetBoatLocation().GetRow()); Assert.Equal(location.GetColumn(), player.GetBoatLocation().GetColumn()); Assert.Equal(location.GetOrientation(), player.GetBoatLocation().GetOrientation()); }
public void shoulHaveMissileHit() { BoatLocation location = new BoatLocation("A", "1", Orientation.X); player.SetOpponentBoatLocation(location); Assert.True(player.FireMissile("A", "1")); Assert.True(player.FireMissile("B", "1")); Assert.True(player.FireMissile("C", "1")); }
public status(int startPriestCount, int startDevilCount, int endPriestCount, int endDevilCount, BoatLocation boatLocation = BoatLocation.Left, PeopleOnBoat peopleOnBoat = PeopleOnBoat.FAILED, status prevStatus = null) { currentStatus = new int[4]; currentStatus[0] = startPriestCount; currentStatus[1] = startDevilCount; currentStatus[2] = endPriestCount; currentStatus[3] = endDevilCount; this.peopleOnBoat = peopleOnBoat; this.boatLocation = boatLocation; prev = prevStatus; }
public void shouldMoveBoat() { BoatLocation location = new BoatLocation("A", "1", Orientation.X); gameView.MoveBoat(player, "w"); gameView.MoveBoat(player, "a"); gameView.MoveBoat(player, "s"); gameView.MoveBoat(player, "d"); gameView.MoveBoat(player, "r"); Assert.Equal(location, player.GetBoatLocation()); }
public void shouldRenderGameWithBoat() { BoatLocation location = new BoatLocation("A", "1", Orientation.X); string renderedBoard = @" | A | B | C | D | E | F | G | H | - 1 🚢 🚢 🚢 * * * * * - - 2 * * * * * * * * - - 3 * * * * * * * * - - 4 * * * * * * * * - - 5 * * * * * * * * - - 6 * * * * * * * * - - 7 * * * * * * * * - - 8 * * * * * * * * - "; string gameRenderedBoard = gameView.RenderBoardWithBoat(location); string sanitizedRenderedBoard = string.Concat(renderedBoard.Where(c => !char.IsWhiteSpace(c))); string sanitizedGameRenderedBoard = string.Concat(gameRenderedBoard.Where(c => !char.IsWhiteSpace(c))); Assert.Equal(sanitizedRenderedBoard, sanitizedGameRenderedBoard); }
public void shouldPlaceBoat() { Dictionary <string, Dictionary <string, string> > testBoard = new Dictionary <string, Dictionary <string, string> >() { { "A", new Dictionary <string, string>() { { "1", "*" }, { "3", "*" }, { "2", "*" }, { "5", "*" }, { "4", "*" }, { "7", "*" }, { "6", "*" }, { "8", "*" } } }, { "B", new Dictionary <string, string>() { { "1", "*" }, { "3", "🚢" }, { "2", "*" }, { "5", "*" }, { "4", "*" }, { "7", "*" }, { "6", "*" }, { "8", "*" } } }, { "C", new Dictionary <string, string>() { { "1", "*" }, { "3", "🚢" }, { "2", "*" }, { "5", "*" }, { "4", "*" }, { "7", "*" }, { "6", "*" }, { "8", "*" } } }, { "D", new Dictionary <string, string>() { { "1", "*" }, { "3", "🚢" }, { "2", "*" }, { "5", "*" }, { "4", "*" }, { "7", "*" }, { "6", "*" }, { "8", "*" } } }, { "E", new Dictionary <string, string>() { { "1", "*" }, { "3", "*" }, { "2", "*" }, { "5", "*" }, { "4", "*" }, { "7", "*" }, { "6", "*" }, { "8", "*" } } }, { "F", new Dictionary <string, string>() { { "1", "*" }, { "3", "*" }, { "2", "*" }, { "5", "*" }, { "4", "*" }, { "7", "*" }, { "6", "*" }, { "8", "*" } } }, { "G", new Dictionary <string, string>() { { "1", "*" }, { "3", "*" }, { "2", "*" }, { "5", "*" }, { "4", "*" }, { "7", "*" }, { "6", "*" }, { "8", "*" } } }, { "H", new Dictionary <string, string>() { { "1", "*" }, { "3", "*" }, { "2", "*" }, { "5", "*" }, { "4", "*" }, { "7", "*" }, { "6", "*" }, { "8", "*" } } } }; Console.WriteLine(this.board.ReturnBoard["B"]); BoatLocation location = new BoatLocation("B", "3", Orientation.X); this.board.PlaceItem(location, "🚢"); Assert.Equal(this.board.ReturnBoard, testBoard); }
public bool Run() { FirstSceneController action = SSDirector.getInstance().currentSceneController as FirstSceneController; if (action.onBoatDevil.Count + action.onBoatPriest.Count == 0) { BoatLocation location = action.boat.transform.position.x < 0 ? BoatLocation.Left : BoatLocation.Right; status cStatus = new status(action.startPriest.Count, action.startDevil.Count, action.endPriest.Count, action.endDevil.Count, location); PeopleOnBoat peopleOnBoat = BFSeach(cStatus); if (location == BoatLocation.Left) { if (peopleOnBoat == PeopleOnBoat.P) { action.actionManager.OnBoat(action.startPriest[0], action.actionManager); } else if (peopleOnBoat == PeopleOnBoat.PP) { action.actionManager.OnBoat(action.startPriest[0], action.actionManager); action.actionManager.OnBoat(action.startPriest[action.startPriest.Count - 1], action.actionManager); } else if (peopleOnBoat == PeopleOnBoat.D) { action.actionManager.OnBoat(action.startDevil[0], action.actionManager); } else if (peopleOnBoat == PeopleOnBoat.DD) { action.actionManager.OnBoat(action.startDevil[0], action.actionManager); action.actionManager.OnBoat(action.startDevil[action.startDevil.Count - 1], action.actionManager); } else if (peopleOnBoat == PeopleOnBoat.PD) { action.actionManager.OnBoat(action.startDevil[0], action.actionManager); action.actionManager.OnBoat(action.startPriest[0], action.actionManager); } else { return(false); } } else { if (peopleOnBoat == PeopleOnBoat.P) { action.actionManager.OnBoat(action.endPriest[0], action.actionManager); } else if (peopleOnBoat == PeopleOnBoat.PP) { action.actionManager.OnBoat(action.endPriest[0], action.actionManager); action.actionManager.OnBoat(action.endPriest[action.endPriest.Count - 1], action.actionManager); } else if (peopleOnBoat == PeopleOnBoat.D) { action.actionManager.OnBoat(action.endDevil[0], action.actionManager); } else if (peopleOnBoat == PeopleOnBoat.DD) { action.actionManager.OnBoat(action.endDevil[0], action.actionManager); action.actionManager.OnBoat(action.endDevil[action.endDevil.Count - 1], action.actionManager); } else if (peopleOnBoat == PeopleOnBoat.PD) { action.actionManager.OnBoat(action.endDevil[0], action.actionManager); action.actionManager.OnBoat(action.endPriest[0], action.actionManager); } else { return(false); } } } else if (action.actionManager.moveToAction == null || !action.actionManager.moveToAction.enable) { action.actionManager.MoveBoat(action.boat, action.actionManager); } return(true); }