private void CollectPayCard(Card card, Player player, MonopolyModelContainer ctx)
        {
            if (card.Parameters.Contains('|'))
            {
                // TODO process params
                int houseCost = -40;
                int hotelCost = -115;
                int houses = player.Realities.Sum(r => r.Houses);
                int hotels = player.Realities.Sum(r => r.Hotels);
                player.Money += houseCost * houses + hotelCost * hotels;
            }
            else
            {
                int amount = Int32.Parse(card.Parameters);
                if (card.From == "Players")
                {
                    var players = ctx.Players.Where(p => p.Game.Id == player.Game.Id && p.Id != player.Id);
                    int counter = 0;
                    foreach (var p in players)
                    {
                        counter++;
                        p.Money -= amount;
                    }

                    player.Money += counter * amount;
                }
                else
                {
                    player.Money += amount;
                }
            }

            player.CardUsed = true;
            ctx.SaveChanges();
        }
        /// <summary>
        /// When a user accepts a game invitation.
        /// </summary>
        /// <param name="userEmail"></param>
        /// <param name="gameId"></param>
        /// <returns></returns>
        internal static bool Accept(string userEmail, int gameId)
        {
            Game game = null;
            using (var ctx = new MonopolyModelContainer())
            {
                game = ctx.Games.SingleOrDefault(g => g.Id == gameId);
                if (game != null)
                {
                    User user = game.PendingUsers.SingleOrDefault(pu => pu.Email == userEmail);
                    if (user != null)
                    {
                        Field field = ctx.Fields.SingleOrDefault(f => f.Name == "Go");
                        game.Users.Add(user);
                        game.PendingUsers.Remove(user);
                        ctx.Players.Add(new Player(game, user, field, false));
                        user.GUID = Guid.NewGuid().ToString("N");
                        ctx.SaveChanges();
                        if (user.IsGuest)
                        {
                            MailSender.SendNewGuid(user.Email, user.GUID);
                        }
                    }
                    else
                    {
                        return false;
                    }
                }
            }

            return game != null;
        }
        internal void DoIntercept(List<Move> moves)
        {
            // delete unused actions
            using (var ctx = new MonopolyModelContainer())
            {
                var actions = ctx.MoveActions.Where(ma => ma.Player.Id == player.Id);
                ctx.MoveActions.RemoveRange(actions);
                ctx.SaveChanges();
            }

            foreach (MoveInterceptor interceptor in interceptors)
            {
                if (interceptor.ShouldCall(player))
                {
                    interceptor.CheckMove(moves, player.Id);
                }
            }

            using (var ctx = new MonopolyModelContainer())
            {
                Player p2 = ctx.Players.SingleOrDefault(p => p.Id == player.Id);
                foreach (var move in moves)
                {
                    if (move.Type != Move.MoveType.MSG)
                    {
                        var action = new MoveAction() { Player = p2, Type = move.Type.ToString(), Offer = move.Offer };
                        ctx.MoveActions.Add(action);
                        ctx.SaveChanges();
                        move.Id = action.Id;
                    }
                }
            }
        }
        public void CheckMove(List<Move> moves, int playerId)
        {
            Random rnd = new Random();
            using (var ctx = new MonopolyModelContainer())
            {
                Player player = ctx.Players.SingleOrDefault(p => p.Id == playerId);
                int cardId = player.Position.Type == "CC" ? rnd.Next(1, NUMOFCARDS + 1) : rnd.Next(NUMOFCARDS + 1, 2 * NUMOFCARDS + 1);
                Card card = ctx.Cards.SingleOrDefault(c => c.Id == cardId);
                ProcessCard cardPorcessor = empty;
                switch (card.Action)
                {
                    case "Goto":
                        cardPorcessor = GotoCard;
                        break;
                    case "Amount":
                        cardPorcessor = CollectPayCard;
                        break;
                    case "GetOutOfJail":
                        cardPorcessor = GetOutOfJailCard;
                        break;
                    default :
                        cardPorcessor = empty;
                        break;
                }

                cardPorcessor(card, player, ctx);
                moves.Add(new Move() { Type = Move.MoveType.MSG, Param = player.Position.Name, Description = card.Description, Help = card.Description });
            }
        }
        public void CheckMove(List<Move> moves, int playerId)
        {
            using (var ctx = new MonopolyModelContainer())
            {
                Player player = ctx.Players.SingleOrDefault(p => p.Id == playerId);
                var auctions = ctx.Auctions.Where(au => au.Game.Id == player.Game.Id);
                foreach (var auction in auctions)
                {
                    Reality reality = player.Realities.SingleOrDefault(r => r.Field.Name == auction.Field.Name);

                    // can bid if he/she is not the current winner
                    // has more money than the current price
                    // he/she is not the owner of the field
                    if (auction.Winner != player && auction.Price < player.Money && reality == null)
                    {
                        moves.Add(new Move()
                        {
                            Type = Move.MoveType.BIDONAUCTION,
                            PlayerId = player.Id,
                            OfferPrice = auction.Price,
                            OfferField = auction.Field.Name
                        });

                    }
                }
            }
        }
 internal static bool CanStart(int gameId)
 {
     using (var ctx = new MonopolyModelContainer())
     {
         Game game = ctx.Games.SingleOrDefault(g => g.Id == gameId);
         return game == null ? false : game.Users.Count >= 2;
     }
 }
Esempio n. 7
0
        /// <summary>
        /// Gets all users, guest and registered too.
        /// </summary>
        /// <returns>All users.</returns>
        IEnumerable<string> GetAllUsers()
        {
            IEnumerable<String> users = null;
            using (var ctx = new MonopolyModelContainer())
            {
                users = from u in ctx.Users
                        select u.Email;
            }

            return users;
        }
Esempio n. 8
0
        internal object Process(int actionId, string param)
        {
            ProcessMove processor = null;
            Move move = null;
            int playerId = 0;
            using (var ctx = new MonopolyModelContainer())
            {
                MoveAction action = ctx.MoveActions.SingleOrDefault(a => a.Id == actionId);
                playerId = action.Player.Id;
                move = new Move()
                {
                    Type = (Move.MoveType)Enum.Parse(typeof(Move.MoveType), action.Type),
                    Param = param,
                    PlayerId = playerId,
                    Offer = action.Offer
                };
                if (action.Offer != null)
                {
                    string[] offerParams = param.Split(';');
                    move.OfferField = offerParams[0];
                    int price = 0;
                    if (!Int32.TryParse(offerParams[1], out price))
                    {
                        // without price the action cannot be processed
                        move.Type = Move.MoveType.MSG;
                    }

                    move.OfferPrice = price;
                }

            }
            if (processors.TryGetValue(move.Type, out processor))
            {
                processor(move);
            }

            // remove unwanted actions
            using (var ctx = new MonopolyModelContainer())
            {
                var actions = ctx.MoveActions.Where(ma => ma.Player.Id == playerId);
                foreach (var action in actions)
                {
                    ctx.MoveActions.Remove(action);
                }

                ctx.SaveChanges();
            }

            return null;
        }
        public void CheckMove(List<Move> moves, int playerId)
        {
            int auctions = 0;
            int jailValue = 0;
            bool hasMoved = false;
            long money = 0;
            using (var ctx = new MonopolyModelContainer())
            {
                Player player = ctx.Players.SingleOrDefault(p => p.Id == playerId);
                auctions = ctx.Auctions.Count(au => au.Game.Id == player.Game.Id);
                jailValue = player.JailValue;
                hasMoved = player.HasMoved;
                money = player.Money;
            }

            if (!hasMoved)
            {
                moves.Add(new Move() {
                    Description = "Roll the dice",
                    PlayerId = playerId,
                    Type = Move.MoveType.ROLL
                });
            }
            else if (auctions > 0)
            {
                moves.Add(new Move()
                {
                    Description = "Finish the auctions of the turn, before you pass.",
                    PlayerId = playerId,
                    Type = Move.MoveType.FINISHAUCTION
                });
            }
            else if (money >= 0 && jailValue == 0)
            {
                moves.Add(new Move() {
                    Description = "Finish this turn",
                    PlayerId = playerId,
                    Type = Move.MoveType.PASS });
            }
            else if (moves.Count == 0)
            {
                moves.Add(new Move() {
                    Description = "You went bankrupt. C'est la vie.",
                    PlayerId = playerId,
                    Type = Move.MoveType.BANKRUPTCY });
            }
        }
Esempio n. 10
0
        public void CheckMove(List<Move> moves, int playerId)
        {
            int jailValue = 0;
            bool hasJailCard = false;
            using (var ctx = new MonopolyModelContainer())
            {
                Player player = ctx.Players.SingleOrDefault(p => p.Id == playerId);
                jailValue = player.JailValue;
                hasJailCard = player.HasJailCard;
            }

            if (jailValue > 0)
            {
                moves.Add(new Move()
                {
                    Type = Move.MoveType.PAYJAIL,
                    Param = "50",
                    PlayerId = playerId,
                    Description = "Buy your freedom ",
                    Help = "You can get out of jail right now if you pay the fee."
                });

                if (jailValue == 3)
                {
                    moves.Add(new Move()
                    {
                        Type = Move.MoveType.MSG,
                        Param = "",
                        Description = "You have to get out of jail in this turn.",
                        Help = "A player can stay in jail maximum for three consecutive. You either pay the fee, use your get out of jail card or roll the same number with both dices. Good luck with that :)."
                    });
                }

                if (hasJailCard)
                {
                    moves.Add(new Move()
                    {
                        Type = Move.MoveType.USEJAILCARD,
                        Param = "",
                        PlayerId = playerId,
                        Description = "Use your card to get out of jail free.",
                        Help = "With this card you can get out of jail for free."
                    });
                }
            }
        }
        /// <summary>
        /// Creates a game.
        /// </summary>
        /// <param name="userEmails">The email address of the users.</param>
        /// <returns></returns>
        internal static int CreateGame(List<string> userEmails)
        {
            Game game = null;
            using (var ctx = new MonopolyModelContainer())
            {
                var q = from u in ctx.Users
                        where userEmails.Contains(u.Email)
                        select u;
                List<User> users = new List<User>();
                User creator = null;
                foreach (var u in q)
                {
                    if (u.Email != userEmails[0])
                    {
                        users.Add(u);
                    }
                    else
                    {
                        creator = u;
                    }

                    if (u.IsGuest)
                    {
                        MailSender.SendNewGuid(u.Email, u.GUID);
                    }
                }

                // cannot create without at least 2 users
                // creator not included
                if (users.Count < 1)
                {
                    return -1;
                }

                Field field = ctx.Fields.SingleOrDefault(f => f.Name == "Go");
                List<User> accepted = new List<User>() { creator };
                game = new Game() { Status = "Pending", StartDate = DateTime.Now, PendingUsers = users, Users = accepted };
                ctx.Games.Add(game);
                ctx.Players.Add(new Player(game, creator, field, true));
                ctx.SaveChanges();
            }

            return game == null ? -1 : game.Id;
        }
        internal static bool AddUserToGame(string userEmail, int gameId)
        {
            using (var ctx = new MonopolyModelContainer())
            {
                Game game = ctx.Games.SingleOrDefault(g => g.Id == gameId);
                User user = ctx.Users.SingleOrDefault(u => u.Email == userEmail);
                if (user == null || game == null)
                {
                    return false;
                }

                if (game.Users.Contains(user) || game.PendingUsers.Contains(user) || game.DeclinedUsers.Contains(user))
                {
                    return false;
                }

                game.PendingUsers.Add(user);
                ctx.SaveChanges();
            }

            return true;
        }
        /// <summary>
        /// Gets all games.
        /// </summary>
        /// <returns>List of the game ids in the db.</returns>
        internal static List<int> GetAllGamesForUser(string userEmail)
        {
            List<int> gameIds = new List<int>();
            using (var ctx = new MonopolyModelContainer())
            {
                User user = ctx.Users.SingleOrDefault(u => u.Email == userEmail);
                if (user != null)
                {
                    foreach (Game g in user.Games)
                    {
                        gameIds.Add(g.Id);
                    }

                    foreach (Game g in user.PendingGames)
                    {
                        gameIds.Add(g.Id);
                    }
                }
            }

            return gameIds;
        }
Esempio n. 14
0
 private void UnmortgageMoveProcessor(Move move)
 {
     using (var ctx = new MonopolyModelContainer())
     {
         Player player = ctx.Players.SingleOrDefault(p => p.Id == move.PlayerId);
         Reality reality = player.Realities.SingleOrDefault(f => f.Field.Name == move.Param);
         player.Money -= reality.Field.Price * 55 / 100;
         reality.IsMortgaged = false;
         ctx.SaveChanges();
     }
 }
Esempio n. 15
0
 private void SellMoveProcessor(Move move)
 {
     using (var ctx = new MonopolyModelContainer())
     {
         Player player = ctx.Players.SingleOrDefault(p => p.Id == move.PlayerId);
         Reality reality = player.Realities.SingleOrDefault(r => r.Field.Name == move.Param);
         // let out exception (it shouldnt be any)
         //if (reality != null)
         {
             reality.Houses = reality.Hotels == 1 ? 4 : reality.Houses - 1;
             reality.Hotels = 0;
             player.Money += reality.Field.HousePrice;
         }
     }
 }
Esempio n. 16
0
        private void RollMoveProcessor(Move move)
        {
            Console.WriteLine("Rollling the dice");
            using (var ctx = new MonopolyModelContainer())
            {
                Player player = ctx.Players.SingleOrDefault(p => p.Id == move.PlayerId);
                Random rnd = new Random();
                int score = rnd.Next(1, 7);
                score += rnd.Next(1, 7);
                int nextPos = player.Position.Id + score;
                if (nextPos > 40)
                {
                    nextPos -= 40;
                    player.Money += 200;
                }

                player.Position = ctx.Fields.SingleOrDefault(f => f.Id == nextPos);
                player.HasMoved = true;
                ctx.SaveChanges();
            }
        }
Esempio n. 17
0
 /// <summary>
 /// Makes the sale and removes the offer from the database.
 /// If the offer is declined it just removes the offer from the database.
 /// </summary>
 /// <param name="move"></param>
 private void ReplyOfferMoveProcessor(Move move)
 {
     using (var ctx = new MonopolyModelContainer())
     {
         Player player = ctx.Players.SingleOrDefault(p => p.Id == move.PlayerId);
         Offer offer = ctx.Offers.SingleOrDefault(o => o.Id == move.Offer.Id);
         if (offer != null && move.Param == "OK")
         {
             Player partner = ctx.Players.SingleOrDefault(p => p.User.Email == offer.From.User.Email);
             Reality reality = offer.Reality;
             player.Money += move.OfferPrice;
             partner.Money -= move.OfferPrice;
             reality.Player = partner;
             partner.Realities.Add(reality);
             player.Realities.Remove(reality);
         }
         ctx.Offers.Remove(offer);
         ctx.SaveChanges();
     }
 }
 /// <summary>
 /// Registers a new user.
 /// </summary>
 /// <param name="email"></param>
 /// <param name="isGuest"></param>
 internal static void RegisterUser(string email, bool isGuest)
 {
     using (var ctx = new MonopolyModelContainer())
     {
         // check whether he is already in the system
         User user = ctx.Users.SingleOrDefault(u => u.Email == email);
         if (user == null)
         {
             user = new User() { Email = email, IsGuest = isGuest, GUID = Guid.NewGuid().ToString("N") };
             ctx.Users.Add(user);
             ctx.SaveChanges();
         }
         else if (!isGuest && user.IsGuest)
         {
             user.IsGuest = false;
             ctx.SaveChanges();
         }
     }
 }
Esempio n. 19
0
        private void AuctionMoveProcessor(Move move)
        {
            using (var ctx = new MonopolyModelContainer())
            {
                Player player = ctx.Players.SingleOrDefault(p => p.Id == move.PlayerId);
                Field field = ctx.Fields.SingleOrDefault(f => f.Name == move.OfferField);
                if (player != null && field != null)
                {
                    var auction = new Auction()
                    {
                        Game = player.Game,
                        Field = field,
                        Price = move.OfferPrice,
                    };

                    ctx.Auctions.Add(auction);
                    ctx.SaveChanges();
                }
            }
        }
Esempio n. 20
0
        private void OfferToBuyMoveProcessor(Move move)
        {
            using (var ctx = new MonopolyModelContainer())
            {
                Player player = ctx.Players.SingleOrDefault(p => p.Id == move.PlayerId);
                Player partner = ctx.Players.SingleOrDefault(p => p.User.Email == move.OfferPartner);
                Reality reality = partner.Realities.SingleOrDefault(r => r.Field.Name == move.OfferField);
                Offer offer = new Offer()
                {
                    From = player,
                    To = partner,
                    Price = move.OfferPrice,
                    Reality = reality
                };

                ctx.Offers.Add(offer);
                ctx.SaveChanges();
            }
        }
Esempio n. 21
0
        private void FinishAuctionProcessor(Move move)
        {
            using (var ctx = new MonopolyModelContainer())
            {
                Player player = ctx.Players.SingleOrDefault(p => p.Id == move.PlayerId);
                // process ongoing auctions
                var auctions = ctx.Auctions.Where(au => au.Game.Id == player.Game.Id);
                foreach (var auction in auctions)
                {
                    if (auction.Winner != null)
                    {
                        Reality reality = ctx.Realities1.SingleOrDefault(r => r.Field.Name == auction.Field.Name && r.Player.Game.Id == player.Game.Id);
                        if (reality != null)
                        {
                            Player owner = reality.Player;
                            player.Money -= auction.Price;
                            owner.Money += auction.Price;
                            owner.Realities.Remove(reality);
                        }
                        else
                        {
                            player.Money -= auction.Price;
                            reality = new Reality()
                            {
                                Field = auction.Field,
                                Hotels = 0,
                                Houses = 0,
                                IsMortgaged = false,
                                Player = player
                            };
                        }

                        player.Realities.Add(reality);
                        ctx.SaveChanges();
                    }

                    ctx.Auctions.Remove(auction);
                }

                ctx.SaveChanges();
            }
        }
Esempio n. 22
0
 private void BuyMoveProcessor(Move move)
 {
     using (var ctx = new MonopolyModelContainer())
     {
         Player player = ctx.Players.SingleOrDefault(p => p.Id == move.PlayerId);
         Reality reality = new Reality()
         {
             Field = player.Position,
             Hotels = 0,
             Houses = 0,
             IsMortgaged = false,
             Player = player
         };
         player.Realities.Add(reality);
         player.Money -= player.Position.Price;
         ctx.SaveChanges();
     }
 }
        /// <summary>
        /// Verifies the given guid.
        /// </summary>
        /// <param name="uniqueId">The guid of the player.</param>
        /// <returns>The game state if the guid is valid; otherwise null.</returns>
        internal static string VerifyUniqueId(string uniqueId)
        {
            string email = null;
            using (var ctx = new MonopolyModelContainer())
            {
                User user = ctx.Users.SingleOrDefault(u => u.GUID == uniqueId);
                if (user != null)
                {
                    email = user.Email;
                }
            }

            return email;
        }
Esempio n. 24
0
        private void BankruptcyMoveProcessor(Move move)
        {
            using (var ctx = new MonopolyModelContainer())
            {
                Player player = ctx.Players.SingleOrDefault(p => p.Id == move.PlayerId);
                player.IsBankrupted = true;
                player.Realities.Clear();
                player.Money = 0;
                player.JailValue = 0;
                if (player.SequenceNumber != player.Game.ActivePlayers)
                {
                    foreach (Player p in player.Game.Players)
                    {
                        if (p.SequenceNumber > player.SequenceNumber)
                        {
                            p.SequenceNumber--;
                        }
                    }
                }

                player.Game.ActivePlayers--;
                player.SequenceNumber = 0;
                ctx.SaveChanges();
            }
        }
Esempio n. 25
0
        public void CheckMove(List<Move> moves, int playerId)
        {
            using (var ctx = new MonopolyModelContainer())
            {
                Player player = ctx.Players.SingleOrDefault(p => p.Id == playerId);
                // TODO only call savechanges once
                var offers = ctx.Offers.Where(o => o.To.Id == player.Id);
                foreach (var offer in offers)
                {
                    moves.Add(new Move()
                    {
                        Type = Move.MoveType.REPLYOFFER,
                        PlayerId = player.Id,
                        OfferPrice = offer.Price,
                        OfferField = offer.Reality.Field.Name,
                        OfferPartner = offer.From.User.Email,
                        Offer = offer,
                        Description = "There is a bid for one of your property",
                        Help = "You can sell your property by Accepting the offer, or refuse the offer by Declining it. The offer is alive until you choose one of the options or the bidder withdraw the offer."
                    });
                }

                List<string> myOffers = new List<string>();
                offers = ctx.Offers.Where(o => o.From.Id == player.Id);
                foreach (var offer in offers)
                {
                    myOffers.Add(offer.Reality.Field.Name);
                }

                if (myOffers.Count > 0)
                {
                    moves.Add(new Move()
                    {
                        Type = Move.MoveType.WITHDRAW,
                        ValidParams = myOffers,
                        PlayerId = player.Id,
                        Description = "You have offers to withdraw.",
                        Help = "You haven't received answer for some of your offers. You may withdraw them."
                    });
                }

                // list realities that can be bought from partners
                List<string> realitiesToBuy = new List<string>();
                var realities = ctx.Realities1.Where(r => r.Player.Game.Id == player.Game.Id && r.Player.Id != player.Id);
                foreach (var reality in realities)
                {
                    if (reality.Houses + reality.Hotels > 0)
                    {
                        continue;
                    }

                    if (reality.Field.Type == "Railway" || reality.Field.Type == "Utility")
                    {
                        realitiesToBuy.Add(reality.Field.Name);
                    }

                    int housesOnThisColor = player.Realities.Where(r => r.Field.Type == reality.Field.Type).Sum(r => r.Hotels + r.Houses);
                    if (housesOnThisColor == 0)
                    {
                        realitiesToBuy.Add(reality.Field.Name);
                    }
                }

                if (realitiesToBuy.Count > 0)
                {
                    moves.Add(new Move() {
                        Type = Move.MoveType.OFFERTOBUY,
                        PlayerId = player.Id,
                        ValidParams = realitiesToBuy,
                        Description = "You can bu some of your partners realities." });
                }

                //var auctions = ctx.Auctions.Where(au => au.Game.Id == player.Game.Id  && !au.PlayersOffered.Contains(player));
                //List<string> offers = new List<string>();
                //foreach (var auction in auctions)
                //{
                //    if (auction.Price <= player.Money)
                //    {
                //        offers.Add(auction.Field.Name);
                //    }
                //}

                //if (offers.Count > 0)
                //{
                //    moves.Add(new OfferMove() { ValidParams = offers, Type = Move.MoveType.BUY, Description = "You can buy from other players." });
                //}
            }
        }
Esempio n. 26
0
 private void UseJailCardMoveProcessor(Move move)
 {
     using (var ctx = new MonopolyModelContainer())
     {
         Player player = ctx.Players.SingleOrDefault(p => p.Id == move.PlayerId);
         player.HasJailCard = false;
         player.JailValue = 0;
         ctx.SaveChanges();
     }
 }
Esempio n. 27
0
 private void WithdrawMoveProcessor(Move move)
 {
     using (var ctx = new MonopolyModelContainer())
     {
         ctx.Offers.Remove(move.Offer);
         ctx.SaveChanges();
     }
 }
Esempio n. 28
0
        private void PassProcessor(Move move)
        {
            using (var ctx = new MonopolyModelContainer())
            {
                Player player = ctx.Players.SingleOrDefault(p => p.Id == move.PlayerId);
                player.User.GUID = Guid.NewGuid().ToString("N");
                player.OwnTurn = false;
                int sequence = player.SequenceNumber + 1;
                if (sequence > player.Game.ActivePlayers)
                {
                    sequence = 1;
                }

                Player nextPlayer = ctx.Players.SingleOrDefault(p => p.Game.Id == player.Game.Id && p.SequenceNumber == sequence);
                nextPlayer.OwnTurn = true;
                nextPlayer.ResetTurn();

                if (player.User.IsGuest)
                {
                    MailSender.SendNewGuid(player.User.Email, player.User.GUID);
                }

                ctx.SaveChanges();
            }
        }
Esempio n. 29
0
 private void BidOnAuctionProcessor(Move move)
 {
     using (var ctx = new MonopolyModelContainer())
     {
         Player player = ctx.Players.SingleOrDefault(p => p.Id == move.PlayerId);
         // process ongoing auctions
         var auction = ctx.Auctions.SingleOrDefault(au => au.Game.Id == player.Game.Id && au.Field.Name == move.OfferField);
         if (auction != null && auction.Price < move.OfferPrice)
         {
             auction.Price = move.OfferPrice;
             auction.Winner = player;
             ctx.SaveChanges();
         }
     }
 }
Esempio n. 30
0
 private void PayJailMoveProcessor(Move move)
 {
     using (var ctx = new MonopolyModelContainer())
     {
         Player player = ctx.Players.SingleOrDefault(p => p.Id == move.PlayerId);
         player.Money -= 50;
         player.JailValue = 0;
         ctx.SaveChanges();
     }
 }