public void Test152()
        {
            PlayGame(true, 3, (0, 0), (1, 1));

            // Human chooses top middle square
            viewModel.HumanMove(square2);

            Assert.IsFalse(viewModel.IsGameOver);
            Assert.AreEqual("Please wait, the computer is thinking ...", viewModel.Message);
            Assert.IsFalse(viewModel.IsHumanTurn);

            Assert.IsFalse(square1.IsHumanTurn);
            Assert.IsFalse(square1.IsEnabled);
            Assert.IsFalse(square1.HighLight);
            Assert.AreEqual("X", square1.Piece);

            Assert.IsFalse(square5.IsHumanTurn);
            Assert.IsFalse(square5.IsEnabled);
            Assert.IsFalse(square5.HighLight);
            Assert.AreEqual("O", square5.Piece);

            Assert.IsFalse(square2.IsHumanTurn);
            Assert.IsFalse(square2.IsEnabled);
            Assert.IsFalse(square2.HighLight);
            Assert.AreEqual("X", square2.Piece);
        }
        public async Task Test15()
        {
            PlayGame(true, 3, (0, 0));

            // Wait for computer to select a square
            var square = await viewModel.ComputerMove();

            // Computer should choose middle square
            Assert.AreEqual(1, square.row);
            Assert.AreEqual(1, square.col);

            Assert.IsFalse(viewModel.IsGameOver);
            Assert.AreEqual("Your turn ...", viewModel.Message);
            Assert.IsTrue(viewModel.IsHumanTurn);

            Assert.IsTrue(square1.IsHumanTurn);
            Assert.IsFalse(square1.IsEnabled);
            Assert.IsFalse(square1.HighLight);
            Assert.AreEqual("X", square1.Piece);

            Assert.IsTrue(square5.IsHumanTurn);
            Assert.IsFalse(square5.IsEnabled);
            Assert.IsFalse(square5.HighLight);
            Assert.AreEqual("O", square5.Piece);
        }
Example #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter Cells detail :");
            var cells = Console.ReadLine().Trim().Split(',');

            Console.WriteLine("Enter Dice Output : ");
            var diceOutputs = Console.ReadLine().Split(new string[] { ", " }, StringSplitOptions.None);

            Console.WriteLine("Number of Players : ");
            var players = Convert.ToInt32(Console.ReadLine());

            PlayGame playGame = new PlayGame(cells, diceOutputs, players);

            playGame.Play();

            Console.WriteLine("");

            for (int i = 0; i < playGame.ListPlayers.Count; i++)
            {
                Console.WriteLine($"{playGame.ListPlayers[i].PlayerName} has total money {playGame.ListPlayers[i].Amount} and asset of amount : {playGame.ListPlayers[i].TotalAssets}");
            }
            Console.WriteLine($"Balance at Bank : {playGame.BankAmount}");

            Console.ReadLine();
        }
Example #4
0
 public void M2Navigation(int id, AppDbContext context, string m)
 {
     if (m == "x")
     {
         M1 m1 = new M1();
         m1.DisplayM1();
     }
     else if (m.Length != 0)
     {
         int v;
         int.TryParse(m.Substring(1), out v);
         if ((m.Length == 2 || m.Length == 3) &&
             ((int)m.ToUpper()[0] >= 65 && (int)m.ToUpper()[0] < 75) &&
             (v >= 1 && v < 11))
         {
             PlayGame pg = new PlayGame(context, id);
             pg.ShootBoard(m);
             DisplayM2(id, context);
         }
         else
         {
             DisplayM2(id, context);
         }
     }
     else
     {
         DisplayM2(id, context);
     }
 }
Example #5
0
 private void Move()
 {
     if (true)
     {
         int move = CanMove(PlayGame.EmptyPos, gameObject.transform.position.x, gameObject.transform.position.y);
         //Debug.Log("Colision " + "cursor " + move);
         if (move != 0)
         {
             PlayGame.UpdateEmpty(gameObject.transform.position.x, gameObject.transform.position.y);
             if (move == 1)
             {
                 transform.Translate(new Vector3(0, -10, 0));
             }
             else if (move == 2)
             {
                 transform.Translate(new Vector3(0, 10, 0));
             }
             else if (move == 3)
             {
                 transform.Translate(new Vector3(-10, 0, 0));
             }
             else if (move == 4)
             {
                 transform.Translate(new Vector3(10, 0, 0));
             }
         }
     }
 }
Example #6
0
        public void StartingMenu()
        {
            int        rowsInput, colsInput;
            eGameType  gameTypeInput;
            ExitOrCont exitOrCont = ExitOrCont.Continue;
            string     firstName, secondName = "pc";

            Console.WriteLine("Hello, Welcome to the game, please enter your name");
            GetValidName(out firstName);
            GetValidChoise(out gameTypeInput);
            while (exitOrCont != ExitOrCont.Exit)
            {
                GetValidBoardSize(out rowsInput, out colsInput);
                InitLetterArray(rowsInput, colsInput);
                if (gameTypeInput == eGameType.AgainstPlayer2)
                {
                    Console.WriteLine("Please enter second player name: ");
                    GetValidName(out secondName);
                }
                m_PlayGame = new PlayGame(firstName, secondName, rowsInput, colsInput, gameTypeInput);
                StartMoves(out exitOrCont);
                if (exitOrCont == ExitOrCont.Continue)
                {
                    GetValidExitOrCont(out exitOrCont);
                }
            }
            Console.WriteLine("Have a nice day");
        }
Example #7
0
        private static void ShowAllowedActions(PlayGame game)
        {
            var sb = new StringBuilder();

            if (game.IsActionAllowed(Blackjack.Action.Hit))
            {
                sb.Append("H)it");
            }

            if (game.IsActionAllowed(Blackjack.Action.Stand))
            {
                sb.Append((sb.Length > 0 ? ", " : string.Empty) + "<SPACEBAR> Stand");
            }

            if (game.IsActionAllowed(Blackjack.Action.DoubleDown))
            {
                sb.Append((sb.Length > 0 ? ", " : string.Empty) + "D)ouble Down");
            }

            if (game.IsActionAllowed(Blackjack.Action.Deal))
            {
                sb.Append((sb.Length > 0 ? ", " : string.Empty) + "<ENTER> Deal");
            }

            Console.SetCursorPosition(Console.BufferWidth - 60, GamePlayMsgPosYOffset);
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine(sb.ToString().PadLeft(60));
            Console.ResetColor();
        }
Example #8
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            PlayGame pg = new PlayGame(_context, id);

            pg.ShootBoard(Game.GMove);

            Game = await _context.Games
                   .Include(u => u.Player1).ThenInclude(b => b.SelfBoard).ThenInclude(r => r.RowNodes).ThenInclude(n => n.Nodes)
                   .Include(v => v.Player1).ThenInclude(p => p.OppenentBoard).ThenInclude(t => t.RowNodes).ThenInclude(m => m.Nodes)
                   .Include(u => u.Player2).ThenInclude(b => b.SelfBoard).ThenInclude(r => r.RowNodes).ThenInclude(n => n.Nodes)
                   .Include(v => v.Player2).ThenInclude(p => p.OppenentBoard).ThenInclude(t => t.RowNodes).ThenInclude(m => m.Nodes)

                   .FirstOrDefaultAsync(m => m.GameId == id);



            if (Game.Player1.Score >= 15 | Game.Player2.Score >= 15)
            {
                return(RedirectToPage("./Edit", new{ id = id, uid = Game.Player1.UserId }));
            }
            else
            {
                return(RedirectToPage("./Play", new { id = id }));
            }
        }
Example #9
0
        public void SendPlayGame(string _RoleID)
        {
            PlayGame szPlayGame = new PlayGame();

            szPlayGame.RoleID = Convert.ToInt32(_RoleID);

            MemoryStream msResult = new MemoryStream();

            Serializer.Serialize <PlayGame>(msResult, szPlayGame);
            byte[]       msSendData     = msResult.ToArray();
            TCPOutPacket szTCPOutPacket = TCPOutPacket.MakeTCPOutPacket(m_GSNetClient.OutPacketPool, msSendData, 0, msSendData.Length, (int)CommandID.CMD_PLAY_GAME);

            if (m_GSNetClient.SendData(szTCPOutPacket))
            {
                SysConOut.WriteLine("发送进入游戏成功");
            }
            else
            {
                SysConOut.WriteLine("发送进入游戏失败");
            }
            //TCPOutPacket szTCPOutPacket = TCPOutPacket.MakeTCPOutPacket(m_tcpOutPacketPool, StringUtil.substitute("{0}", _RoleID),
            //    (int)TCPServerCmds.CMD_PLAY_GAME);
            //if (m_GSNetClient.SendData(szTCPOutPacket))
            //    SysConOut.WriteLine("发送进入游戏成功");
            //else
            //    SysConOut.WriteLine("发送进入游戏失败");
            m_GSNetClient.OutPacketPool.Push(szTCPOutPacket);
        }
Example #10
0
    private void _PlayChess(byte[] data)
    {
        PlayGame result = NetworkUtils.Deserialize <PlayGame>(data);

        if (!result.isSuc)
        {
            Info.Instance.Print("下棋操作失败");
            return;
        }

        switch (result.Challenger)
        {
        case Chess.None:
            break;

        case Chess.Black:
            NetworkPlayer.Instance.OnPlayingChange(false);
            Info.Instance.Print("黑棋胜利");
            break;

        case Chess.White:
            NetworkPlayer.Instance.OnPlayingChange(false);
            Info.Instance.Print("白棋胜利");
            break;

        case Chess.Draw:
            NetworkPlayer.Instance.OnPlayingChange(false);
            Info.Instance.Print("平局");
            break;
        }

        //实例化棋子
        NetworkGameplay.Instance.InstChess(result.Chess, new Vec2(result.X, result.Y));
    }
Example #11
0
    public override void Draw()
    {
        buttonRect = new Rect((Screen.width - buttonWidth) / 2, (Screen.height - (buttoneHeight * 4) - buttonSpace * 2) / 2, buttonWidth, buttoneHeight);

        if (GUI.Button(buttonRect, local.GetLocalizedValue("help"), style))
        {
            game.gameState = Game.GameState.help;
        }

        buttonRect.y += buttoneHeight + buttonSpace;

        if (GUI.Button(buttonRect, local.GetLocalizedValue("continue"), style))
        {
            game.gameState = Game.GameState.game;
            sounds.Pause();
        }

        buttonRect.y += buttoneHeight + buttonSpace;

        if (GUI.Button(buttonRect, local.GetLocalizedValue("leaders"), style))
        {
            PlayGame.ShowLeaderboardUI();
        }

        buttonRect.y += buttoneHeight + buttonSpace;

        if (GUI.Button(buttonRect, local.GetLocalizedValue("exit"), style))
        {
            Application.Quit();
        }
    }
        public async Task Test152347()
        {
            PlayGame(true, 3, (0, 0), (1, 1), (0, 1), (0, 2), (1, 0));

            // Wait for computer to select a 3nd square
            var square = await viewModel.ComputerMove();

            // Computer should choose bottom left
            Assert.AreEqual(2, square.row);
            Assert.AreEqual(0, square.col);

            Assert.IsTrue(viewModel.IsGameOver);
            Assert.AreEqual("Bad luck, the computer beat you!", viewModel.Message);
            Assert.IsFalse(viewModel.IsHumanTurn);

            Assert.IsFalse(square1.IsHumanTurn);
            Assert.IsFalse(square1.IsEnabled);
            Assert.IsFalse(square1.HighLight);
            Assert.AreEqual("X", square1.Piece);

            Assert.IsFalse(square5.IsHumanTurn);
            Assert.IsFalse(square5.IsEnabled);
            Assert.IsTrue(square5.HighLight);
            Assert.AreEqual("O", square5.Piece);

            Assert.IsFalse(square2.IsHumanTurn);
            Assert.IsFalse(square2.IsEnabled);
            Assert.IsFalse(square2.HighLight);
            Assert.AreEqual("X", square2.Piece);

            Assert.IsFalse(square3.IsHumanTurn);
            Assert.IsFalse(square3.IsEnabled);
            Assert.IsTrue(square3.HighLight);
            Assert.AreEqual("O", square3.Piece);

            Assert.IsFalse(square4.IsHumanTurn);
            Assert.IsFalse(square4.IsEnabled);
            Assert.IsFalse(square4.HighLight);
            Assert.AreEqual("X", square4.Piece);

            Assert.IsFalse(square7.IsHumanTurn);
            Assert.IsFalse(square7.IsEnabled);
            Assert.IsTrue(square7.HighLight);
            Assert.AreEqual("O", square7.Piece);

            // Game Over !!!
        }
Example #13
0
        public void ManualGameNotStarted()
        {
            var gameStarted = false;

            var game = new PlayGame();

            Assert.AreEqual(gameStarted, game.IsStarted, $@"Expected result: {gameStarted}, Actual result: {game.IsStarted}");
        }
Example #14
0
        static void Main(string[] args)
        {
            Console.WriteLine("Podaj swoje imię:");
            string nameofUser = Console.ReadLine();

            Console.WriteLine($"Witaj {nameofUser} w Quizie.");
            while (true)
            {
                Console.WriteLine("Wybierz jedną z 5 opcji:");
                MenuActionService menuAction = new MenuActionService();
                menuAction.ShowMenu();
                int choice;
                Int32.TryParse(Console.ReadLine(), out choice);

                if (choice == 1)
                {
                    PlayGame playGame = new PlayGame();
                    int      points   = playGame.StartGame();
                    User     user     = new User(nameofUser, points);
                    CreateTableOfTheBestResults createTableOfTheBestResults = new CreateTableOfTheBestResults();
                    createTableOfTheBestResults.AddNewUserAndHisScore(user);
                }
                else if (choice == 2)
                {
                    CategoryManager categoryManager = new CategoryManager();
                    categoryManager.OpenCategory();
                    categoryManager.AddNewCategory();
                    Console.WriteLine("Kliknij Enter, aby przejść z powrotem do menu głównego.");
                    Console.ReadKey();
                    Console.Clear();
                }
                else if (choice == 3)
                {
                    QuestionManager questionManager = new QuestionManager();
                    questionManager.CheckCategoryToAddQuestion();
                    Console.WriteLine("\r\nPytanie i odpowiedzi zostały pomyślnie dodane.");
                    Console.WriteLine("\r\nNaciśnij Enter, aby przejść do menu głównego.");
                    Console.ReadKey();
                    Console.Clear();
                }
                else if (choice == 4)
                {
                    ReturnBestScores returnBestsScores = new ReturnBestScores();
                    var users = returnBestsScores.ReturningMethod();
                    ShowInRightOrder showInRightOrder = new ShowInRightOrder();
                    var usersInRightOrder             = showInRightOrder.OrganizeTheList(users);
                    showInRightOrder.ShowOrganizedList(usersInRightOrder);
                    Console.WriteLine("\r\nNaciśnij Enter, aby przejść do menu głównego.");
                    Console.ReadKey();
                    Console.Clear();
                }
                else
                {
                    Console.WriteLine("Do zobaczenia!");
                    break;
                }
            }
        }
        public async Task LetsPlayGameAsync_ReturnsGameOverIfNoCardsLeft()
        {
            //Arrange
            var card = new Card(
                id: Guid.NewGuid(),
                gameId: Guid.NewGuid(),
                faceValue: 5453,
                nextValue: 12432);

            var game = new Game(
                Guid.NewGuid(),
                "Game1",
                card,
                true,
                0,
                DateTime.Now,
                null);

            var request = new PlayGame
            {
                GameId             = game.Id,
                FaceValue          = 5453,
                IsNextNumberHigher = false
            };

            _mockGameRepository
            .Setup(exec =>
                   exec.GetGameByIdAsync(
                       It.IsAny <Guid>(),
                       It.IsAny <CancellationToken>()))
            .ReturnsAsync(game);

            //Act
            var result = await _gameController
                         .LetsPlayGameAsync(request) as OkObjectResult;

            //Assert
            _mockGameRepository
            .Verify(exec =>
                    exec.GetGameByIdAsync(
                        It.IsAny <Guid>(),
                        It.IsAny <CancellationToken>()),
                    Times.Once);

            result
            .Should()
            .NotBeNull();

            result.StatusCode
            .Should()
            .Be((int)HttpStatusCode.OK);

            var gamePlayResult = result.Value as GamePlayResults;

            gamePlayResult.Message
            .Should()
            .Be("The Game is Over!");
        }
Example #16
0
        public void drawCardTest()
        {
            var gameRepositoryMock = new GameRepositoryMock();
            var playGame           = new PlayGame(gameRepositoryMock);

            var returnObject = playGame.drawCard(0);

            Assert.AreEqual(null, returnObject);//no deck and card in a new Game
        }
Example #17
0
        public async Task <IActionResult> PlayAsync([FromRoute] Guid gameId, [FromBody] PlayGame command)
        {
            command.GameId = gameId;

            await module.DispatchAsync(command);

            logger.LogInformation("Hand Played by {playerId} - {hand}", command.PlayerId, command.Hand);
            return(StatusCode((int)HttpStatusCode.Accepted));
        }
Example #18
0
        private async void Field_Click(object sender, MouseButtonEventArgs e)
        {
            if (Game.GameState == GameState.Lost || Game.GameState == GameState.Won)
            {
                return;
            }

            var button = (FrameworkElement)sender;
            var tag    = (FieldTag)button.Tag;

            PlayGame playgameRequest = new PlayGame
            {
                Row    = tag.Row,
                Column = tag.Column
            };

            if (e.ChangedButton == MouseButton.Left && tag.Field.State == FieldState.Close)
            {
                playgameRequest.Action = FieldAction.Open;
            }
            else if (e.ChangedButton == MouseButton.Right)
            {
                if (tag.Field.State == FieldState.Close)
                {
                    playgameRequest.Action = FieldAction.Flag;
                }
                else if (tag.Field.State == FieldState.Flag)
                {
                    playgameRequest.Action = FieldAction.Mark;
                }
                else if (tag.Field.State == FieldState.Mark)
                {
                    playgameRequest.Action = FieldAction.Reset;
                }
                else
                {
                    return;
                }
            }
            else
            {
                return;
            }

            var response = await _communication.SendAndRecieveAsync <GameDto>(playgameRequest);

            if (response == null)
            {
                ConnectionLost = true;
                Close();
                return;
            }

            UpdateFields(response.Board.Fields);
            UpdateWindow(response);
        }
Example #19
0
        public void getPunishmentTest()
        {
            var gameRepositoryMock = new GameRepositoryMock();
            var playGame           = new PlayGame(gameRepositoryMock);

            var returnObject = playGame.getPunishment(0);
            var expected     = "test";

            Assert.AreEqual(expected.GetType(), returnObject.GetType());
        }
Example #20
0
        public void resetExecutionOfTaskRatingTest()
        {
            var gameRepositoryMock = new GameRepositoryMock();
            var playGame           = new PlayGame(gameRepositoryMock);

            var returnObject = playGame.resetExecutionOfTaskRating(0);
            var expected     = new ReturnObject(true, "test");

            Assert.AreEqual(expected.isSuccess(), returnObject.isSuccess());
        }
Example #21
0
        public void changeActualPlayerTest()
        {
            var gameRepositoryMock = new GameRepositoryMock();
            var playGame           = new PlayGame(gameRepositoryMock);

            var returnObject = playGame.changeActualPlayer(0, 0);
            var expected     = new ReturnObject(true, "test");

            Assert.AreEqual(expected.isSuccess(), returnObject.isSuccess());
        }
Example #22
0
        public void finishGameTest()
        {
            var gameRepositoryMock = new GameRepositoryMock();
            var playGame           = new PlayGame(gameRepositoryMock);

            var returnObject = playGame.finishGame(new GameEntity(0, "Test"));
            var expected     = new ReturnObject(true, "test");

            Assert.AreEqual(expected.isSuccess(), returnObject.isSuccess());
        }
Example #23
0
 public object GetResponse(Request request)
 {
     return(request switch
     {
         CreateGame createGame => CreateGame(createGame),
         GetRanking getRanking => GetRanking(getRanking),
         Handshake handshake => Handshake(handshake),
         PlayGame playGame => PlayGame(playGame),
         _ => throw new ArgumentException()
     });
Example #24
0
        public void StartManualGame()
        {
            var gameStarted = true;

            var game = new PlayGame();

            game.Start(PlayMode.Manual);

            Assert.AreEqual(gameStarted, game.IsStarted, $@"Expected result: {gameStarted}, Actual result: {game.IsStarted}");
        }
        private static void ManualGame(string playerName)
        {
            var playService = new PlayGame();
            var rollCount   = 1;

            playService.Start(Shared.Enums.PlayMode.Manual);

            if (playService.IsStarted)
            {
                Console.Write($"Enter pins bowled on roll {rollCount}: ");
                var pinsBowled = Console.ReadLine();

                while (!playService.IsFinished)
                {
                    var roll = playService.TrackScore(int.Parse(pinsBowled));

                    if (roll.RollType == Shared.Enums.RollType.Strike)
                    {
                        Console.WriteLine("You bowled a STRIKE.");
                    }
                    else if (roll.RollType == Shared.Enums.RollType.Spare)
                    {
                        Console.WriteLine("You bowled a Spare.");
                    }

                    rollCount++;

                    Console.WriteLine("");
                    Console.WriteLine($"{playerName} your current score is {playService.GameScore}");
                    Console.WriteLine("");

                    if (!playService.IsFinished)
                    {
                        Console.Write($"Enter pins bowled on roll {rollCount}: ");
                        pinsBowled = Console.ReadLine();

                        Console.Clear();
                    }
                }

                Console.Clear();
                Console.WriteLine($"{playerName} your final score is {playService.GameScore}");
                Console.WriteLine("");
                Console.WriteLine("");
                Console.WriteLine($"Press Enter {playerName} to end the game.");

                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Game failed to start.");
                Console.WriteLine("Press Enter to Exit.");
                Console.ReadLine();
            }
        }
Example #26
0
    //public int tanknumber;SB


    // Use this for initialization
    void Start()
    {
        rb = GetComponent <Rigidbody>();
        initialMaterial = tankMaterial.material;
        GameObject pGameObj = GameObject.FindGameObjectWithTag("PlayGameObj");

        pgame = pGameObj.GetComponent <PlayGame>();
        GameObject commandMenuObj = GameObject.FindGameObjectWithTag("CommandUnitCanvas");

        commandMenu = commandMenuObj.GetComponent <Canvas>();
        commandUnit = commandMenu.GetComponent <CommandUnit>();
    }
Example #27
0
    public void CmdThrust(float thrusting, int spin)
    {
        if (PlayGame.GetComplete() || !tc.alive)
        {
            this.thrusting = 0;
            this.spin      = 0;
            return;
        }

        this.thrusting = thrusting;
        this.spin      = spin;
    }
Example #28
0
    void Awake()
    {
        GameObject temp;

        temp = GameObject.Find("ScriptsToAttach");
        if (temp != null)
        {
            playgame = temp.GetComponent <PlayGame>();
        }
        SetGamePiecesSections();
        setBorderPercent();
    }
Example #29
0
        public static void Main(string[] args)
        {
            Console.BufferWidth   = Console.WindowWidth = ConsoleWindowWidth;
            Console.BufferHeight  = Console.WindowHeight = ConsoleWindowHeight;
            Console.CursorVisible = false;

            var game = new PlayGame();// Instantiate the game

            game.AllowedActionsChanged += OnAllowedActionsChanged;
            game.LastStateChanged      += OnLastStateChanged;
            game.Dealer.Hand.Changed   += OnHandChanged;
            game.Player.Hand.Changed   += OnHandChanged;
            game.Play();

            while (true)
            {
                var key = Console.ReadKey(true);

                switch (key.Key)
                {
                case ConsoleKey.Enter:      //Deal
                case ConsoleKey.Spacebar:   // Stand
                    if (game.IsActionAllowed(Blackjack.Action.Deal))
                    {
                        game.DealHands();
                    }
                    else
                    {
                        game.Stand();
                    }

                    break;

                case ConsoleKey.H:      // Hit
                    if (game.IsActionAllowed(Blackjack.Action.Hit))
                    {
                        game.Hit();
                    }
                    break;

                case ConsoleKey.D:      // Double Down
                    if (game.IsActionAllowed(Blackjack.Action.Hit))
                    {
                        game.Hit();
                        if (game.IsActionAllowed(Blackjack.Action.Stand))
                        {
                            game.Stand();
                        }
                    }
                    break;
                }
            }
        }
Example #30
0
        public UIPlayGame desrz(PlayGame playGame)
        {
            UIPlayGame p = new UIPlayGame();

            p.Gamer1          = playGame.Gamer1;
            p.Gamer2          = playGame.Gamer2;
            p.Queue           = playGame.Queue;
            p.GameId          = playGame.GameId;
            p.WhiteCoordinate = JsonConvert.DeserializeObject <List <Coordinate> >(playGame.WhiteCoordinate);
            p.BlackCoordinate = JsonConvert.DeserializeObject <List <Coordinate> >(playGame.BlackCoordinate);
            p.Move            = JsonConvert.DeserializeObject <Move>(playGame.Move);
            return(p);
        }
Example #31
0
	public void play()
	{

		PlayGame plyobj = new PlayGame ();

		PlayCommand plycmd = new ConcretePlay (plyobj);

		PlayInvoker invobj = new PlayInvoker ();
		invobj.SetCommand (plycmd);
		invobj.Execute ();


	}
Example #32
0
 public object Any(PlayGame request)
 {
     var dds = new DdsConnect();
     var game = GameReplayer.Replay(request.PBN);
     var player = BridgeHelper.GetNextPlayerPosition(game.Declarer);
     while (game.Tricks.Count != 13)
     {
         var result = dds.SolveBoard(game);
         var card = result.FutureCards.Cards[0];
         player = game.PlayCard(card, player);
     }
     var play = game.Tricks.Select(x => BridgeHelper.DeckToPbnPlay(x.Deck));
     return new PlayGameResponse
     {
         Play =  string.Join("\n",play)
     };
 }
	public ConcretePlay(PlayGame playObj) : base (playObj)
	{

	  
	}
	public PlayCommand(PlayGame playObj)
	{

		this.playObj = playObj;
	}	
Example #35
0
	void Start()
	{
		pg = GameObject.Find ("start_button").GetComponent<PlayGame> ();
	}