private void gameForm_Click(object sender, EventArgs e) { int buttonCellLocation = (sender as Button).TabIndex; Point currentPositionInDemiBoard = new Point(); currentPositionInDemiBoard.X = buttonCellLocation % this.m_BoardSize; currentPositionInDemiBoard.Y = (buttonCellLocation - currentPositionInDemiBoard.X) / this.m_BoardSize; MoveOption moveOption = new MoveOption(new Point()); bool isPointInList; if (this.m_PlayerArray[0].IsMyTurn) { isPointInList = InputManager.IsInputInListOfPossibleMoves(this.m_PlayerArray[0].m_ValidMoves, currentPositionInDemiBoard, ref moveOption); InputManager.UpdateBoard(moveOption, this.m_PlayerArray[0].CoinColor); } else { isPointInList = InputManager.IsInputInListOfPossibleMoves(this.m_PlayerArray[1].m_ValidMoves, currentPositionInDemiBoard, ref moveOption); InputManager.UpdateBoard(moveOption, this.m_PlayerArray[1].CoinColor); } this.updateGameBoardForm(BoardState.m_PlayerPositionsInDemiBoard); if (this.PlayerArray[1].UserType == Player.eUserType.Computer && this.PlayerArray[1].IsMyTurn) { this.computerMoveManager(); } this.checkIfGameOver(); }
public static void UpdateBoard(MoveOption i_ChosenInputMove, char i_PlayerColor) { Point tempBoardPoint = new Point(); for (int i = 0; i < i_ChosenInputMove.m_WhereIsTheDamageOfTheMove.Length; i++) { tempBoardPoint = i_ChosenInputMove.PossibleMove; for (int j = 0; j <= i_ChosenInputMove.m_WhereIsTheDamageOfTheMove[i]; j++) { BoardState.m_PlayerPositionsInDemiBoard[tempBoardPoint.X, tempBoardPoint.Y] = i_PlayerColor; if (i_PlayerColor == k_BlackPlayerChar) { if (!BoardState.m_BlackPositionList.Contains(tempBoardPoint)) { BoardState.m_BlackPositionList.AddFirst(tempBoardPoint); BoardState.m_WhitePositionList.Remove(tempBoardPoint); } } else { if (!BoardState.m_WhitePositionList.Contains(tempBoardPoint)) { BoardState.m_WhitePositionList.AddFirst(tempBoardPoint); BoardState.m_BlackPositionList.Remove(tempBoardPoint); } } tempBoardPoint = CheckWhatDirection(i, tempBoardPoint); } } }
public void MoveExamplesNeuralNets(MoveOption moveOption) { // moves the neural nets examples to the streaming assets folder // instead of the normal plugin path string examplesNetsDev = GESTURE_DEV_PATH + EXAMPLES_NETS_PATH; string examplesNetsPlugin = STREAMING_ASSETS_PATH + Config.NEURAL_NET_PATH; switch (moveOption) { case MoveOption.ToPlugin: MoveFolder(examplesNetsDev + EXAMPLE_1_NAME + "/", examplesNetsPlugin + EXAMPLE_1_NAME); MoveFolder(examplesNetsDev + EXAMPLE_2_NAME + "/", examplesNetsPlugin + EXAMPLE_2_NAME); break; case MoveOption.ToDev: if (!System.IO.Directory.Exists(examplesNetsDev)) { System.IO.Directory.CreateDirectory(examplesNetsDev); } MoveFolder(examplesNetsPlugin + EXAMPLE_1_NAME + "/", examplesNetsDev + EXAMPLE_1_NAME); MoveFolder(examplesNetsPlugin + EXAMPLE_2_NAME + "/", examplesNetsDev + EXAMPLE_2_NAME); break; } }
private void computerMoveManager() { MoveOption computerBestOptionMove = new MoveOption(); computerBestOptionMove = InputManager.FindMaxDamage(this.PlayerArray[1].m_ValidMoves); InputManager.UpdateBoard(computerBestOptionMove, this.m_PlayerArray[1].CoinColor); this.updateGameBoardForm(BoardState.m_PlayerPositionsInDemiBoard); }
protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); Event.ConfigureForDatabase(builder); Region.ConfigureForDatabase(builder); LocationGroup.ConfigureForDatabase(builder); Location.ConfigureForDatabase(builder); BagCategory.ConfigureForDatabase(builder); Item.ConfigureForDatabase(builder); PlacedItem.ConfigureForDatabase(builder); Currency.ConfigureForDatabase(builder); CurrencyAmount.ConfigureForDatabase(builder); ElementalType.ConfigureForDatabase(builder); ElementalTypeRelation.ConfigureForDatabase(builder); Ability.ConfigureForDatabase(builder); PvpTier.ConfigureForDatabase(builder); PokemonAvailability.ConfigureForDatabase(builder); PokemonVarietyUrl.ConfigureForDatabase(builder); Entities.PokemonSpecies.ConfigureForDatabase(builder); PokemonVariety.ConfigureForDatabase(builder); PokemonForm.ConfigureForDatabase(builder); Evolution.ConfigureForDatabase(builder); MoveDamageClass.ConfigureForDatabase(builder); Move.ConfigureForDatabase(builder); MoveTutor.ConfigureForDatabase(builder); MoveTutorMove.ConfigureForDatabase(builder); MoveTutorMovePrice.ConfigureForDatabase(builder); MoveLearnMethod.ConfigureForDatabase(builder); MoveLearnMethodLocation.ConfigureForDatabase(builder); MoveLearnMethodLocationPrice.ConfigureForDatabase(builder); LearnableMove.ConfigureForDatabase(builder); LearnableMoveLearnMethod.ConfigureForDatabase(builder); TimeOfDay.ConfigureForDatabase(builder); Season.ConfigureForDatabase(builder); SeasonTimeOfDay.ConfigureForDatabase(builder); SpawnType.ConfigureForDatabase(builder); Spawn.ConfigureForDatabase(builder); SpawnOpportunity.ConfigureForDatabase(builder); Nature.ConfigureForDatabase(builder); HuntingConfiguration.ConfigureForDatabase(builder); Build.ConfigureForDatabase(builder); ItemOption.ConfigureForDatabase(builder); MoveOption.ConfigureForDatabase(builder); NatureOption.ConfigureForDatabase(builder); ItemStatBoost.ConfigureForDatabase(builder); Entities.ItemStatBoostPokemon.ConfigureForDatabase(builder); ImportSheet.ConfigureForDatabase(builder); }
public void SquaresShouldCompareFalseIfSquareIndexAndMiniMaxScoreDoNotMatch() { var subject = new MoveOption(2, 10); var compare = new MoveOption(2, 0); bool result = subject == compare; Assert.IsFalse(result); }
public Sprite(string baseTX, DrawPriority priority, MoveOption moveState = MoveOption.STATIC) { Texture = Singleton.Content.AddTexture(baseTX); TextureClicked = Singleton.Content.AddTexture(baseTX + "Clicked"); TextureOver = Singleton.Content.AddTexture(baseTX + "Over"); TextureDisabled = Singleton.Content.AddTexture(baseTX + "Disabled"); Priority = priority; MoveState = moveState; SpriteColor = Color.White; MouseEvent = new MouseEvents(this); }
public void SquaresShouldCompareTrueIfSquareIndexAndMiniMaxScoreMatch() { var squareIndex = 2; var miniMaxScore = 10; var subject = new MoveOption(squareIndex, miniMaxScore); var compare = new MoveOption(squareIndex, miniMaxScore); bool result = subject == compare; Assert.IsTrue(result); }
public void Update() { if (setMovement) SetMovement(); if (moveOption == MoveOption.MoveToLocation) { Vector3 distToTarget = moveToLocation - transform.position; if (distToTarget.sqrMagnitude < threshhold * threshhold) { // Stop myRigidBody.velocity = Vector3.zero; moveOption = MoveOption.Arrived; } } }
public static MoveOption FindMaxDamage(LinkedList <MoveOption> i_ComputerValidMoves) { MoveOption bestOptionalMove = new MoveOption(); int maxDamage = i_ComputerValidMoves.First.Value.DamageOfMove; bestOptionalMove = i_ComputerValidMoves.First.Value; foreach (MoveOption currentPossibleMove in i_ComputerValidMoves) { if (currentPossibleMove.DamageOfMove > maxDamage) { maxDamage = currentPossibleMove.DamageOfMove; bestOptionalMove = currentPossibleMove; } } return(bestOptionalMove); }
private void Board_TileHoverChange(Point spot, bool hovering) { MoveOption option = currentOptions.Find(o => o.Spot.Equals(spot)); if (option != null && option.HoppedPieces.Count > 0) { option.HoppedPieces.ForEach(delegate(Point piece) { if (hovering) { board.HighlightHopPiece(piece); } else { board.ResetPieceHighlight(piece); } }); } }
public void GetTopMoveIndexShouldReturnIndexOfAWinningMoveIfAvailable() { string[] testTokens = new string[] { "O", "", "", "O", "X", "O", "", "X", "O" }; var testBoard = new Board(testTokens); var ownerMovesNext = true; var winningMoveOption1 = new MoveOption(1, MMConstants.MINIMAX_MAX); var winningMoveOption2 = new MoveOption(6, MMConstants.MINIMAX_MAX); var winningMoves = new MoveOption[] { winningMoveOption1, winningMoveOption2 }; var winningMoveIndices = winningMoves.Select(move => move.SquareIndex); var result = subject.GetMiniMaxMove(testBoard, ownerMovesNext); Assert.That(winningMoveIndices, Has.Member(result)); }
private static void updatePossibleMovesArray(LinkedList <MoveOption> i_MoveOptions, Point currentPoint, eDirections i_UpOrDown, eDirections i_LeftOrRight, ePossibleDirections i_OptionalDiractions, char i_OpponentCoin) { int numOfFlippedCoins = 0; Point tempOfcurrentPoint = new Point(); tempOfcurrentPoint = currentPoint; MoveOption foundOptionalMove = new MoveOption(new Point(0, 0)); bool isPointInListAlready = false; tempOfcurrentPoint.X += (int)i_UpOrDown; tempOfcurrentPoint.Y += (int)i_LeftOrRight; while (tempOfcurrentPoint.X <= m_PlayerPositionsInDemiBoard.GetLength(0) - 1 && tempOfcurrentPoint.X >= 0 && tempOfcurrentPoint.Y >= 0 && tempOfcurrentPoint.Y <= m_PlayerPositionsInDemiBoard.GetLength(0) - 1) { if (m_PlayerPositionsInDemiBoard[tempOfcurrentPoint.X, tempOfcurrentPoint.Y] != i_OpponentCoin && m_PlayerPositionsInDemiBoard[tempOfcurrentPoint.X, tempOfcurrentPoint.Y] != 0) { break; } if (m_PlayerPositionsInDemiBoard[tempOfcurrentPoint.X, tempOfcurrentPoint.Y] == 0) { if (!InputManager.IsInputInListOfPossibleMoves(i_MoveOptions, tempOfcurrentPoint, ref foundOptionalMove)) { foundOptionalMove.PossibleMove = tempOfcurrentPoint; i_MoveOptions.AddFirst(foundOptionalMove); } else { isPointInListAlready = InputManager.IsInputInListOfPossibleMoves(i_MoveOptions, tempOfcurrentPoint, ref foundOptionalMove); } foundOptionalMove.m_WhereIsTheDamageOfTheMove[(int)i_OptionalDiractions] = numOfFlippedCoins; foundOptionalMove.DamageOfMove = numOfFlippedCoins + foundOptionalMove.DamageOfMove; break; } numOfFlippedCoins++; tempOfcurrentPoint.X += (int)i_UpOrDown; tempOfcurrentPoint.Y += (int)i_LeftOrRight; } }
public void MoveIntegrations(MoveOption moveOption) { string integrationsDev = GESTURE_DEV_PATH + INTEGRATIONS_PATH; string integrationsPlugin = GESTURE_PLUGIN_PATH + INTEGRATIONS_PATH; switch (moveOption) { case MoveOption.ToPlugin: MoveFolder(integrationsDev + PLAYMAKER_FOLDER_NAME, integrationsPlugin + PLAYMAKER_FOLDER_NAME); //if (System.IO.Directory.Exists(integrationsDev)) // System.IO.Directory.Delete(integrationsDev); break; case MoveOption.ToDev: if (!System.IO.Directory.Exists(integrationsDev)) { System.IO.Directory.CreateDirectory(integrationsDev); } MoveFolder(integrationsPlugin + PLAYMAKER_FOLDER_NAME, integrationsDev + PLAYMAKER_FOLDER_NAME); break; } }
public void MoveTutorials(MoveOption moveOption) { string tutorialsDev = GESTURE_DEV_PATH + TUTORIALS_PATH; string tutorialsPlugin = GESTURE_PLUGIN_PATH + TUTORIALS_PATH; switch (moveOption) { case MoveOption.ToPlugin: MoveFolder(tutorialsDev + "Getting Started/", tutorialsPlugin + "Getting Started/"); //if (System.IO.Directory.Exists(tutorialsDev)) // System.IO.Directory.Delete(tutorialsDev); break; case MoveOption.ToDev: if (!System.IO.Directory.Exists(tutorialsDev)) { System.IO.Directory.CreateDirectory(tutorialsDev); } MoveFolder(tutorialsPlugin + "Getting Started/", tutorialsDev + "Getting Started/"); break; } }
public void Move(MoveOption direction) { switch (direction) { case MoveOption.Up: if (CurrentPosition.YPosition < YLength - 1) { CurrentPosition = Spaces[CurrentPosition.XPosition, CurrentPosition.YPosition + 1]; CheckMine(); } break; case MoveOption.Down: if (CurrentPosition.YPosition > 0) { CurrentPosition = Spaces[CurrentPosition.XPosition, CurrentPosition.YPosition - 1]; CheckMine(); } break; case MoveOption.Left: if (CurrentPosition.XPosition > 0) { CurrentPosition = Spaces[CurrentPosition.XPosition - 1, CurrentPosition.YPosition]; CheckMine(); } break; case MoveOption.Right: if (CurrentPosition.XPosition < XLength - 1) { CurrentPosition = Spaces[CurrentPosition.XPosition + 1, CurrentPosition.YPosition]; CheckMine(); } break; } _renderer.Render(this, _outputWriter); }
private void Lobby_TileSelected(bool kinged, MoveOption option) { Dispatcher?.Invoke(() => { // unhighlight everything from current players turn try { Console.WriteLine("Got Tile Selected: " + option.Spot + " - " + option.HoppedPieces.Count); board.ResetPieceHighlight(selectedPiece); currentForcedPieces.ForEach(delegate(GamePiece piece) { board.ResetPieceHighlight(piece.Position); }); currentOptions.ForEach(delegate(MoveOption moveOption) { board.ResetTileHighlight(moveOption.Spot); moveOption.HoppedPieces.ForEach(delegate(Point piece) { board.ResetPieceHighlight(piece); }); }); // move selected piece on board if (kinged) { board.KingPiece(selectedPiece); } board.MovePiece(selectedPiece, option.Spot); selectedPiece = new Point(-1, -1); // remove hopped pieces from board option.HoppedPieces.ForEach(delegate(Point piece) { board.RemovePiece(piece); }); } catch (Exception e) { Console.WriteLine(e); } }); }
public void MoveExamples(MoveOption moveOption) { string examplesDev = GESTURE_DEV_PATH + EXAMPLES_PATH; string examplesPlugin = GESTURE_PLUGIN_PATH + EXAMPLES_PATH; switch (moveOption) { case MoveOption.ToPlugin: MoveFolder(examplesDev + EXAMPLE_1_NAME + "/", examplesPlugin + EXAMPLE_1_NAME); MoveFolder(examplesDev + EXAMPLE_2_NAME + "/", examplesPlugin + EXAMPLE_2_NAME); //if (System.IO.Directory.Exists(examplesDev)) // System.IO.Directory.Delete(examplesDev); break; case MoveOption.ToDev: if (!System.IO.Directory.Exists(examplesDev)) { System.IO.Directory.CreateDirectory(examplesDev); } MoveFolder(examplesPlugin + EXAMPLE_1_NAME + "/", examplesDev + EXAMPLE_1_NAME); MoveFolder(examplesPlugin + EXAMPLE_2_NAME + "/", examplesDev + EXAMPLE_2_NAME); break; } }
public Button(string textureName, OverlayOption category, DrawPriority priority, MoveOption state = MoveOption.STATIC) : base(textureName, priority, category, state) { LoadAttributes(); }
public Frame(string textureName, DrawPriority priority, MoveOption moveOption = MoveOption.STATIC) : base(textureName, priority, moveOption) { Slots = new SortedSet <Slot <UIObject> >(); Children = new List <Slot <UIObject> >(); }
public static bool IsInputInListOfPossibleMoves(LinkedList <MoveOption> i_ValidMoves, Point i_InputMove, ref MoveOption io_FoundPointInList) { bool isMoveFoundInList = false; foreach (MoveOption MoveInArray in i_ValidMoves) { if (MoveInArray.PossibleMove == i_InputMove) { isMoveFoundInList = true; io_FoundPointInList = MoveInArray; break; } } return(isMoveFoundInList); }