Example #1
0
    public PieceMove GetNextMove(Vector3 StartLoc, BoardPiece cat, BoardSpace moveSpace, Board.Direction direction)
    {
        //movesIndex += 1;
        PieceMove move = Moves[movesIndex];

        if (move.GetMyType() == "Walk" && Board.GetBoardDistance(move.moveSpace.GetSpaceByDirection(direction).GetCenterPoint(), cat.transform.position) > 0.1f)
        {
            moveSpace = moveSpace.GetSpaceByDirection(direction);
            Debug.Log("flipped " + moveSpace.name + " " + move.moveSpace.name);

            Board.Direction flippedDir = Board.FlipDirection(direction);
            cat.pieceDirection = flippedDir;
            GetMoveFlipped(flippedDir, moveSpace);
            return(move);
        }
        else if (movesIndex + 1 >= Moves.Count)
        {
            isActive = false;
            return(null);
        }
        else
        {
            movesIndex += 1;
            initializeMove(StartLoc, cat, moveSpace, direction, movesIndex);
            return(GetMove());
        }
    }
Example #2
0
        private static State MaxSearch(State state, int depth, int side, int alpha, int beta)
        {
            if (depth <= 0)
            {
                state.EvaluateValue();
                return(state);
            }

            var newAlpha = alpha;
            var newBeta  = beta;
            var moveList = state.GenerateAllMoves(side);
            var it       = moveList.GetEnumerator();

            var maxState = new State();

            maxState.SetValue(newAlpha);

            while (it.MoveNext())
            {
                var newState = PieceMove.MovePiece(state, it.Current);
                var newValue = MinSearch(newState, depth - 1, ChangeSide(side), newAlpha, newBeta).GetValue();
                if (newValue > newAlpha)
                {
                    maxState = newState;
                    newAlpha = newValue;
                    maxState.SetValue(newValue);
                }
                if (newBeta <= newAlpha)
                {
                    return(maxState);
                }
            }
            return(maxState);
        }
Example #3
0
        private void OnTurnStarted()
        {
            Invoke((MethodInvoker)delegate
           {
               Text = $"{chessboard.CurrentPlayerTurn}'s turn";
           });

            if (MatchMaker.PlaySoundOnMove)
            {
                soundPlayer.Play();
            }

            UpdateBoard();

            if (chessboard.Moves.Count == 0)
            {
                return;
            }

            PieceMove recentMove = chessboard.Moves.Peek().Moves[0];
            recentMoveFrom = recentMove.Source;
            recentMoveTo = recentMove.Destination;

            ResetAllTableStyling();
        }
Example #4
0
        private static State MinSearch(State state, int depth, int side)
        {
            if (depth <= 0)
            {
                state.EvaluateValue();
                return(state);
            }

            var moveList = state.GenerateAllMoves(side);
            var it       = moveList.GetEnumerator();

            State minState = null;
            var   value    = int.MaxValue;

            while (it.MoveNext())
            {
                var newState = PieceMove.MovePiece(state, it.Current);
                var newValue = MaxSearch(newState, depth - 1, ChangeSide(side)).GetValue();
                if (newValue < value)
                {
                    minState = newState;
                    value    = newValue;
                    minState.SetValue(newValue);
                }
            }
            return(minState);
        }
Example #5
0
    /// <summary>
    /// If forced a roll
    /// </summary>
    /// <param name="node"></param>
    private IEnumerator ForcedWayAction(TileNode node)
    {
        PieceMove requestedMove = new PieceMove(firstSelection, new MoveSet.Move(firstSelection, false, node), moves);

        if (requestedMove.Execute())
        {
            moveHistory.Add(requestedMove);
            GameObject.Find("MoveHistoryPanel").GetComponent <MoveHistoryHandler>().addMove(moveHistory[moveHistory.Count - 1]);

            // unhighlight the way moves
            foreach (TileNode moveTile in moves)
            {
                moveTile.unhighlight();
            }

            if (requestedMove.Result == PieceMove.ResultType.Win)
            {
                SceneManager.LoadScene("EndMenu");
            }

            // Wait for overstack
            yield return(new WaitUntil(() => OverstackUI.done));

            state          = State.Playing;
            firstSelection = null;
            NextTurn();
        }
    }
 public override PieceMove MoveModifier(PieceMove move)
 {
     if (isProtectedPieceSafeAfterMove(move))
     {
         return move;
     }
     return null;
 }
 private void PublishPieceMovedEvent(string gameId, PieceMove move)
 {
     serviceBus.Publish(new PieceMovedEvent
     {
         GameId    = gameId,
         PieceMove = move.AsDto()
     });
 }
 public override PieceMove MoveModifier(PieceMove move)
 {
     if (Board.IsInRange(Position + move.Shift))
     {
         return(move);
     }
     return(null);
 }
Example #9
0
 protected void AcceptMove(PieceMove move)
 {
     if (move.IsPartOf(drawer.board))
     {
         //drawer.SwitchBoard (move.GetNextBoard ());
         handler.ApplyBoard(move.GetNextBoard());
     }
 }
Example #10
0
 void Start()
 {
     pieceMove = GetComponent <PieceMove>();
     boxes.Add(this);
     m_Renderer     = GetComponent <SpriteRenderer>();
     originalColor  = m_Renderer.color;
     gameController = GameObject.Find("GameController");
     gameControl    = gameController.GetComponent <GameControl>();
 }
        private void SaveAndPublishLastMove(string gameId, MovesLog movesLog)
        {
            var lastMove  = movesLog.LastMove;
            var pieceMove = new PieceMove(lastMove.SequenceNumber, lastMove.Move.From, lastMove.Move.To);

            SaveMove(gameId, pieceMove);

            PublishPieceMovedEvent(gameId, pieceMove);
        }
Example #12
0
 void Start()
 {
     pieceMove = GetComponent <PieceMove>();
     animators = GetComponentsInChildren <Animator>();
     foreach (Animator animator in animators)
     {
         animator.speed = 1 / fixingTime;
     }
 }
Example #13
0
    protected void SetUp()
    {
        GameObject    go  = new GameObject();
        BoardLocation bl  = new BoardLocation(go.transform, 1, 1);
        BoardLocation bl2 = new BoardLocation(go.transform, 2, 2);

        pM1 = new PieceMove(bl);
        pM2 = new PieceMove(bl, bl2);
    }
Example #14
0
File: Pawn.cs Project: hcesar/Chess
        protected override bool CanMove(PieceMove move)
        {
            if (!base.CanMove(move))
                return false;

            if (IsCaptureMove(move.Target))
                return this.Board[move.Target] != null || this.IsEnPassantCapture(move.Target);

            return this.Board[move.Target] == null;
        }
Example #15
0
        public void TestGenerateAllMoveAtMidState()
        {
            var fromX       = 1;
            var fromY       = 7;
            var toX         = 4;
            var toY         = 7;
            var midState    = PieceMove.MovePiece(State, fromX, fromY, toX, toY);
            var newMoveList = Cannon.GenerateAllMove(midState, toX, toY);

            Assert.AreEqual(8, newMoveList.Count);
        }
Example #16
0
        public void TestPieceListPrint()
        {
            var    stringBefore = State.ToString(State.GetPieceList());
            int    fromX        = 1;
            int    fromY        = 9;
            int    toX          = 2;
            int    toY          = 7;
            State  midState     = PieceMove.MovePiece(State, fromX, fromY, toX, toY);
            String stringAfter  = midState.ToString(midState.GetPieceList());

            Assert.AreNotEqual(stringBefore, stringAfter);
        }
Example #17
0
    //Moves piece to location. If it is an enemy it destroys the piece. If it moves to and edge of board, it kings the piece.
    public void movePiece(string location)
    {
        PieceMove move = getMove(location); //Converts string to PieceMove

        if (move != null)                   //ugly, but probably avoiding bugs
        //Kills enemy piece

        {
            List <PieceMove> moveAgain = new List <PieceMove>();

            if (move.pieceTaken != null)
            {
                Destroy(move.pieceTaken.piece, 0.25f);
                move.pieceTaken.piece = null;

                moveAgain = getLegalMoves(move.moveTo).Where(x => x.pieceTaken != null).ToList();                  //returns a list of moves that involve taking another piece
            }

            //Kings piece
            if (move.kingPiece)
            {
                selectedPiece.piece.GetComponent <PieceHandler>().king      = true;
                selectedPiece.piece.transform.GetChild(0).gameObject.active = true;
            }


            //Moves the piece
            //selectedPiece.piece.GetComponent<PieceHandler>().target = move.moveTo.boardLocation.transform.position;
            //selectedPiece.piece.GetComponent<PieceHandler>().currentLerpTime = 0f;
            //selectedPiece.piece.transform = move.moveTo.boardLocation.transform.position;
            Vector3 target = move.moveTo.boardLocation.transform.position;
            //Debug.Log (target);
            GameObject _checker = selectedPiece.piece;
            //PieceHandler _ph = selectedPiece.piece.GetComponent<PieceHandler> ();
            //_ph.PrintMe ();

            _checker.GetComponent <PieceHandler>().Move(target);
            _checker.transform.position = target;

            CmdChangeTargetPosition(_checker, target);

            //Reassigns reference
            move.moveTo.piece   = selectedPiece.piece;
            selectedPiece.piece = null;

            // toggleCurrentPlayer();
        }
        //resets the board values.
        resetBoardDisplay();
        selectedPiece = null;
        currentLegalMoves.Clear();
    }
Example #18
0
        public void TestLegalMoveSuicide()
        {
            var fromX = 1;
            var fromY = 7;
            var toX   = 1;
            var toY   = 9;

            var midState = PieceMove.MovePiece(State, fromX, fromY, toX, toY);
            var toXFinal = 1;
            var toYFinal = 9;

            Assert.AreEqual(false, Cannon.IsLegalMove(midState, toX, toY, toXFinal, toYFinal));
        }
        public override bool ValidateNewMove(PieceMove move)
        {
            if (!InnerPieceDecorator.ValidateNewMove(move))
            {
                return(false);
            }

            if (move.MoveTypes.Contains(MoveType.Move) && move.Shift == LongMove.Shift)
            {
                return(CanLongMove());
            }
            return(true);
        }
Example #20
0
    public PieceMove RecursiveRate(List <PieceMove> moves, ChessBoard initial, PlayerColor color, int level)
    {
        var enemy = color == PlayerColor.white ? PlayerColor.black : PlayerColor.white;
        var score = ScorePlayer(initial, enemy);

        PieceMove best   = moves[0];
        float     mscore = float.MinValue;

        foreach (var move in moves)
        {
            var nboard = move.GetNextBoard();
            move.score += (score - ScorePlayer(nboard, enemy)) * 3;
            move.score += nboard.GetAllPlayerMoves(color, false).Count * 0.5f;
            move.score += nboard.GetAllPlayerMoves(enemy, false).Count * 0.25f;

            if (nboard.IsChecked(enemy))
            {
                move.score += 0.5f;
                var nextMoves = nboard.GetAllPlayerMoves(enemy, true);
                if (nextMoves.Count < 1)
                {
                    move.score = float.MaxValue;
                    best       = move;
                    mscore     = move.score;
                    return(move);
                }
                //Debug.Log (move.score + " : " + move.id + " level : " + level);
                //Debug.Log();
            }

            if (level > 0)
            {
                var nmoves = nboard.GetAllPlayerMoves(enemy, true);
                if (nmoves.Count < 1)
                {
                    // a.k.a enemy has no moves but he is not checked.
                    move.score = float.MinValue;
                    continue;
                }
                move.score -= RecursiveRate(nmoves, nboard, enemy, level - 1).score;
            }

            if (move.score >= mscore)
            {
                best   = move;
                mscore = move.score;
            }
        }
        return(best);
    }
Example #21
0
 public void HighlightLabel(ChessMoveClick moveClick, PieceMove move)
 {
     label.Click -= eventHandler;
     eventHandler = (sender, e) => moveClick(move);
     label.Click += eventHandler;
     if (label.Image == null)
     {
         label.BackColor = highlightColor;
     }
     else
     {
         label.BackColor = targetColor;
     }
 }
Example #22
0
 private bool IsPathClear(Position destination, PieceMove move)
 {
     for (
         Position checkedPosition = Position + move.Shift;
         checkedPosition != destination;
         checkedPosition += move.Shift)
     {
         if (Board.GetPiece(checkedPosition) != null)
         {
             return(false);
         }
     }
     return(true);
 }
Example #23
0
        public void TestCloningCap()
        {
            var fromX = 1;
            var fromY = 7;
            var toX   = 1;
            var toY   = 0;

            var before = State.ToString();

            PieceMove.MovePiece(State, fromX, fromY, toX, toY);
            var after = State.ToString();

            Assert.AreEqual(before, after);
        }
Example #24
0
        public void TestPieceListSimple()
        {
            int fromX = 1;
            int fromY = 9;
            int toX   = 2;
            int toY   = 7;

            var pieceListBefore = State.GetPieceList();
            var midState        = PieceMove.MovePiece(State, fromX, fromY, toX, toY);
            var pieceListAfter  = midState.GetPieceList();

            var piece1 = pieceListBefore.Get(Utility.GetOneDimention(fromX, fromY));
            var piece2 = pieceListAfter.Get(Utility.GetOneDimention(fromX, fromY));

            Console.WriteLine(midState);
            Assert.AreNotEqual(piece1.GetNumber(), piece2.GetNumber());
        }
Example #25
0
        public void TestMovePieceSimple()
        {
            var states = new State();

            states = PieceMove.MovePiece(states, 7, 7, 4, 7);//user

            Debug.WriteLine(states.ToString());
            //states = PieceMove.MovePiece(states, 1, 2, 1, 9);//com
            states = (AlphaBetaSearch.DoSearch(states, 1));
            Debug.WriteLine(states.ToString());
            states = PieceMove.MovePiece(states, 0, 9, 1, 9);//user
            Debug.WriteLine(states.ToString());
            Assert.AreEqual(30, states.GetPieceList().Count);
            var piece = PieceFactory.GetPiece(23, 1, 9);

            Assert.AreEqual(typeof(Rook), piece.GetType());
        }
    public override GameAction act()
    {
        //if ( Input.GetMouseButtonDown(0) )
        if ( Input.touches.Length == 1 )
        {
          Touch touchedFinger = Input.touches[0]; // Get input of touches
          if ( touchedFinger.phase == TouchPhase.Ended )
          //if ( true )
          {
            m_Ray = Camera.main.ScreenPointToRay( touchedFinger.position );
            //m_Ray = Camera.main.ScreenPointToRay ( Input.mousePosition );

            if (Physics.Raycast(m_Ray.origin, m_Ray.direction,
                                    out m_RayCastHit, Mathf.Infinity))
            {
                GameAction incoming = null;
                switch (m_RayCastHit.transform.tag)
                {
                    case "Attacker":
                        Piece touchedAttacker = m_RayCastHit.collider.gameObject.GetComponent<Piece>();
                        incoming = new PieceSelection(touchedAttacker.index, true);
                        break;

                    case "Defender":
                    case "King":
                        Piece touchedDefender = m_RayCastHit.collider.gameObject.GetComponent<Piece>();
                        incoming = new PieceSelection(touchedDefender.index, false);
                        break;

                    case "Square":
                        if (Game.turnState == TurnState.PIECE_SELECTED)
                        {
                            Square touchedSquare = m_RayCastHit.collider.gameObject.GetComponent<Square>();
                            incoming = new PieceMove(touchedSquare.coord);
                        }else
                            Game.audio.playError ();
                        break;
                }
                return incoming;
            }else
                Game.audio.playError ();
          }
        }
        return null;
    }
Example #27
0
 public void AddKingMoves(List <PieceMove> validMoves)
 {
     if (type == PieceType.King)
     {
         List <PieceMove> moves = node.board.GetAllPlayerMoves(OppositeTeam(), false);
         // if the king didnt move a.k.a he is at the start pos, and he isn't attacked.
         // we can do the rook king thing, so this is the logic to check if its valid move.
         if (!moved && !PieceMove.CheckOverlap(moves, node))
         {
             var board = node.board;
             var rook  = board.nodes[node.x - 3, node.y];
             if (rook.piece != null && !rook.piece.moved && rook.piece.type == PieceType.Rook)
             {
                 var rookEndCord = board.nodes[node.x - 1, node.y];
                 var kingEndCord = board.nodes[node.x - 2, node.y];
                 if (rookEndCord.piece == null && kingEndCord.piece == null)
                 {
                     if (!PieceMove.CheckOverlap(moves, rookEndCord) &&
                         !PieceMove.CheckOverlap(moves, kingEndCord))
                     {
                         validMoves.Add(new ComplexMove(node, kingEndCord, rook, rookEndCord, true));
                     }
                 }
             }
             rook = board.nodes[node.x + 4, node.y];
             if (rook.piece != null && !rook.piece.moved && rook.piece.type == PieceType.Rook)
             {
                 var rookEndCord = board.nodes[node.x + 1, node.y];
                 var kingEndCord = board.nodes[node.x + 2, node.y];
                 var lastPos     = board.nodes[node.x + 3, node.y];
                 if (rookEndCord.piece == null && kingEndCord.piece == null && lastPos.piece == null)
                 {
                     if (!PieceMove.CheckOverlap(moves, rookEndCord) &&
                         !PieceMove.CheckOverlap(moves, kingEndCord) && !PieceMove.CheckOverlap(moves, lastPos))
                     {
                         validMoves.Add(new ComplexMove(node, kingEndCord, rook, rookEndCord, true));
                     }
                 }
             }
         }
     }
 }
        public override bool ValidateNewMove(PieceMove move)
        {
            if (!InnerPieceDecorator.ValidateNewMove(move))
            {
                return(false);
            }
            var pieceAtDestination = Board.GetPiece(Position + move.Shift);

            var containsMove = move.MoveTypes.Contains(MoveType.Kill);

            if (pieceAtDestination != null && pieceAtDestination.Color != Color && !containsMove)
            {
                return(false);
            }
            if ((pieceAtDestination == null || pieceAtDestination.Color == Color) && containsMove)
            {
                return(false);
            }
            return(true);
        }
Example #29
0
        public void TestPieceList()
        {
            Setup();
            var fromX      = 1;
            var fromY      = 9;
            var toX        = 2;
            var toY        = 7;
            var midState   = PieceMove.MovePiece(State, fromX, fromY, toX, toY);
            var pieceList  = midState.GetPieceList();
            var sizeBefore = pieceList.Count;

            var toXkillTeamMate = 3;
            var toYkillTeamMate = 9;

            midState  = PieceMove.MovePiece(midState, toX, toY, toXkillTeamMate, toYkillTeamMate);
            pieceList = midState.GetPieceList();
            var sizeAfter = pieceList.Count;

            Assert.AreEqual(sizeBefore, sizeAfter + 1);
        }
Example #30
0
    //public void InitializeMoving()
    //{

    //}
    public bool MovePiece()//bool isStarting, bool forward, Board.Direction direction, MoveSet moveSet)
    {
        //if (isStarting) InitializeMoves(direction, moveSet);
        PieceMove move       = moveSet.GetMove();
        Vector3   moveVector = move.ForwardVector();
        float     friction   = currentBoardLoc.GetFriction(transform.position.x, transform.position.z);

        moveVector = friction * Speed * Time.deltaTime * moveVector;
        float remainingDistance = Vector3.Distance(transform.position, move.GetEndLoc());

        if (remainingDistance > moveVector.magnitude)
        {
            transform.position += moveVector;
        }
        else
        {
            //PieceMove nextMove = moveSet.GetNextMove(transform.position, this, currentBoardLoc, pieceDirection);
            if (moveSet.HasNextMove())
            {
                BoardSpace nextSpace = currentBoardLoc.GetSpaceByDirection(pieceDirection);
                pieceDirection = move.Direction;
                PieceMove nextMove = moveSet.GetNextMove(transform.position, this, currentBoardLoc, pieceDirection);
                //currentBoardLoc = nextSpace;
                move = nextMove;
                float deltaTime = Time.deltaTime * moveVector.magnitude / remainingDistance;
                moveVector = move.ForwardVector();
                friction   = 1; //currentBoardLoc.GetFriction()
                moveVector = friction * Speed * deltaTime * moveVector;
            }
            else
            {
                transform.position = move.GetEndLoc();

                PieceStat = PieceStats.idle;
                return(false);
            }
        }

        return(true);
    }
Example #31
0
        private Move.MoveStatus HandleUserMove(State state, int fromX, int fromY, int toX, int toY)
        {
            var move = Move.MoveStatus.NoError;

            var fromK = Utility.GetOneDimention(fromX, fromY);
            var piece = CurrentState.GetPieceList().Get(fromK);

            if (piece.GetSide() == State.EmptySpace)
            {
                move = Move.MoveStatus.WrongPiece;
            }
            else if (piece.GetSide() != State.UserTurn)
            {
                move = Move.MoveStatus.WrongPiece;
            }
            else if (!PieceMove.MovePieceLegal(state, fromX, fromY, toX, toY))
            {
                move = Move.MoveStatus.Illegal;
            }
            PieceMove.MovePiece(state, fromX, fromY, toX, toY);
            return(move);
        }
        public override PieceMove MoveModifier(PieceMove move)
        {
            var pieceAtDestination = Board.GetPiece(Position + move.Shift);

            if (pieceAtDestination == null || pieceAtDestination.Color == Color || move.MoveTypes.Contains(MoveType.Kill))
            {
                if (pieceAtDestination != null && pieceAtDestination.Color != Color)
                {
                    move.MoveTypes = new MoveType[] { MoveType.Kill };
                }
                else
                {
                    move.MoveTypes = move.MoveTypes.Where(m => m != MoveType.Kill).ToArray();
                    if (move.MoveTypes.Length == 0)
                    {
                        return(null);
                    }
                }
                return(move);
            }
            return(null);
        }
Example #33
0
 private void connection_PieceMoved(PieceMove move)
 {
     this.Board.Move(move.Source, move.Target, move.PawnPromotedTo);
 }
Example #34
0
File: King.cs Project: hcesar/Chess
 protected override bool CanMove(PieceMove move)
 {
     return base.CanMove(move) && !this.Board.IsUnderAttack(move.Target, move.Piece.Player.Opponent());
 }
Example #35
0
    public override GameAction act()
    {
        // Do RayCast
        m_Ray = new Ray (m_Camera.position, m_Camera.forward);
        //m_Ray = Camera.main.ScreenPointToRay ( Input.mousePosition );

        Selectable newSelectable = null;
        if ( Physics.Raycast ( m_Ray.origin, m_Ray.direction, out m_RayCastHit, Mathf.Infinity ) )
            newSelectable = m_RayCastHit.collider.gameObject.GetComponent<Selectable>();

            // Check change of pointed object
        if ( (selectablePointed && ! selectablePointed.Equals ( newSelectable )) ||
             (! selectablePointed && newSelectable ) 							 )
        {
            if ( validHit )
                selectablePointed.rollOver ( false ); // Reset previous Selectable (if any)

            validHit = false;
            if ( newSelectable )
            {
                if ( newSelectable.tag != "Square" )
                    validHit = true;
                else if ( Game.turnState == TurnState.PIECE_SELECTED )
                {
                    Square sqrPointed = (Square)newSelectable;
                    if ( sqrPointed.state == SquareState.VALID || sqrPointed.state == SquareState.VALID_TRACED )
                        validHit = true;
                }
                if ( validHit )
                    newSelectable.rollOver ( true ); // Call RollOver according to "Hit" and "TurnState"
            }
            selectablePointed = newSelectable; // Assign selectablePointed
        }

        if ( Input.touches.Length == 1 ) // Check cardboard's button input (for v2.0)
        //if ( true )
        {
            Touch touchedFinger = Input.touches[0]; // Get input of touches
            GameAction incoming = null;
            if ( touchedFinger.phase == TouchPhase.Ended )
            //if ( Input.GetMouseButtonDown(0) )
            {
                if  ( validHit )
                {
                    switch ( selectablePointed.tag )
                    {
                    case "Attacker":
                        incoming = new PieceSelection ( ((Piece)selectablePointed).index, true );
                        break;

                    case "Defender":
                    case "King":
                        incoming = new PieceSelection ( ((Piece)selectablePointed).index, false );
                        break;

                    case "Square":
                        incoming = new PieceMove ( ((Square)selectablePointed).coord );
                        break;
                    }
                    selectablePointed.rollOver (false);
                    selectablePointed = null;
                    validHit = false;
                    return incoming; // Create and return GameAction according to "Hit" & "TurnState"
                }
                else
                    Game.audio.playError ();
            }
        }
        return null;
    }
Example #36
0
 private void board_PieceMoved(PieceMove move)
 {
     this.Enqueue(new MoveAction(move.Source, move.Target, move.PawnPromotedTo));
 }
Example #37
0
 /// <summary>
 /// Adds an item to the possible selections.
 /// </summary>
 public void Add(PieceMove Move, Board Board)
 {
     this._Items.Add(new _Possible()
     {
         Move = Move,
         Board = Board
     });
 }