コード例 #1
1
        private int SimulateGamesAndGetSmartPlayerWins(int gamesToSimulate)
        {
            var smartPlayer = new SmartPlayer();
            var smartPlayerWins = 0;

            var dummyPlayer = new DummyPlayer();

            var game = new SantaseGame(smartPlayer, dummyPlayer);

            for (var i = 0; i < gamesToSimulate; i++)
            {
                var winner = game.Start(i % 2 == 0 ? PlayerPosition.FirstPlayer : PlayerPosition.SecondPlayer);
                if (winner == PlayerPosition.FirstPlayer)
                {
                    smartPlayerWins++;
                }
            }

            // Console.WriteLine(smartPlayerWins);
            return smartPlayerWins;
        }
 protected override ISantaseGame CreateGame()
 {
     IPlayer firstPlayer = new SmartPlayer();
     IPlayer secondPlayer = new SmartPlayer();
     ISantaseGame game = new SantaseGame(firstPlayer, secondPlayer); // new ConsoleLogger("[game] "));
     return game;
 }
 protected override ISantaseGame CreateGame()
 {
     IPlayer firstPlayer = new HelionPlayer();
     IPlayer secondPlayer = new SmartPlayer();
     ISantaseGame game = new SantaseGame(firstPlayer, secondPlayer);
     return game;
 }
コード例 #4
0
        protected override ISantaseGame CreateGame()
        {
            IPlayer      firstPlayer  = new SmartPlayer();                          // new PlayerWithLoggerDecorator(new SmartPlayer(), new ConsoleLogger("[-]"))
            IPlayer      secondPlayer = new SantiagoPlayer();
            ISantaseGame game         = new SantaseGame(firstPlayer, secondPlayer); // new ConsoleLogger("[game] "));

            return(game);
        }
コード例 #5
0
        protected override ISantaseGame CreateGame()
        {
            IPlayer      firstPlayer  = new SmartPlayer();
            IPlayer      secondPlayer = new DummyPlayerChangingTrump();
            ISantaseGame game         = new SantaseGame(firstPlayer, secondPlayer); // new ConsoleLogger("[game] "));

            return(game);
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: W3SS/SantaseGameEngine
        // ReSharper disable once UnusedMember.Local
        private static ISantaseGame CreateGameVersusBot()
        {
            IPlayer      firstPlayer  = new ConsolePlayer(5, 10);
            IPlayer      secondPlayer = new SmartPlayer();
            ISantaseGame game         = new SantaseGame(firstPlayer, secondPlayer);

            return(game);
        }
コード例 #7
0
        // ReSharper disable once UnusedMember.Local
        private static ISantaseGame CreateGameVersusBot()
        {
            Console.BufferHeight = Console.WindowHeight = 17;
            Console.BufferWidth  = Console.WindowWidth = 50;

            IPlayer      firstPlayer  = new ConsolePlayer(5, 10);
            IPlayer      secondPlayer = new SmartPlayer();
            ISantaseGame game         = new SantaseGame(firstPlayer, secondPlayer);

            return(game);
        }
コード例 #8
0
    /* Animations
     */
    private void AnimatePickUp()
    {
        // Move this object to the PLAYER's hand
        SmartPlayer sp = targets[0].GetComponent <SmartPlayer>();

        transform.position = targets[0].transform.position + (sp != null ? sp.GetHandPosition(true) : new Vector3(0.6f, 0, 0));

        // Set the state
        currState = (int)States.PICKUP;
        offset    = transform.position - targets[0].transform.position;
    }
コード例 #9
0
        /// <summary>
        /// Запуск игры
        /// </summary>
        public JsonResult Start(string settings)
        {
            GameState gameState = new GameState();

            var gameSettings = JsonHelper.DeserialiazeWithType <GameSettings>(settings);


            IPlayer[] gamePlayers = new IPlayer[4];
            int       index       = 0;

            foreach (var pl in gameSettings.players)
            {
                switch (pl)
                {
                case "robot":
                    gamePlayers[index++] = new SmartPlayer();
                    break;

                case "human":
                    gamePlayers[index++] = new WebHumanPlayer();
                    break;

                default:
                    gamePlayers[index++] = new SmartPlayer2();
                    break;
                }
            }

            while (index < 4)
            {
                gamePlayers[index++] = new SmartPlayer();
            }

            if (!gameSettings.mapId.HasValue)
            {
                gameSettings.mapId = new Random().Next();
            }

            gameState.board = new Board(gamePlayers, gameSettings.mapId.Value);
            gameState.game  = new Game(gamePlayers, gameState.board);

            Session["test"] = gameState;

            var service = new DrawService();
            var map     = service.Map(gameState.board);

            return(Json(new {
                gamename = "test",
                map = map,
                mapId = gameSettings.mapId.Value,
                stat = service.GetStatistics(gameState.game)
            }));
        }
コード例 #10
0
ファイル: MainPage.xaml.cs プロジェクト: gb-umich/SANTIAGO
        public MainPage()
        {
            this.InitializeComponent();

            if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Desktop")
            {
                this.AdRow.Height = new GridLength(90);
                // this.AdMediator_2D55AF.Height = 90;
                // this.AdMediator_2D55AF.Width = 768;
            }
            else
            {
                this.AdRow.Height = new GridLength(80);
                // this.AdMediator_2D55AF.Height = 80;
                // this.AdMediator_2D55AF.Width = 480;
            }

            this.playerCardControls = new[]
            {
                this.PlayerCard1, this.PlayerCard2, this.PlayerCard3,
                this.PlayerCard4, this.PlayerCard5, this.PlayerCard6
            };

            this.uiPlayer                  = new UiPlayer();
            this.uiPlayer.RedrawCards     += this.UiPlayerRedrawCards;
            this.uiPlayer.RedrawTrumpCard += this.UiPlayerRedrawTrumpCard;
            this.uiPlayer.RedrawNumberOfCardsLeftInDeck          += this.UiPlayerOnRedrawNumberOfCardsLeftInDeck;
            this.uiPlayer.RedrawPlayerPlayedCard                 += this.UiPlayerOnRedrawPlayerPlayedCard;
            this.uiPlayer.RedrawOtherPlayerPlayedCard            += this.UiPlayerOnRedrawOtherPlayerPlayedCard;
            this.uiPlayer.RedrawCurrentAndOtherPlayerRoundPoints +=
                this.UiPlayerOnRedrawCurrentAndOtherPlayerRoundPoints;
            this.uiPlayer.RedrawCurrentAndOtherPlayerTotalPoints +=
                this.UiPlayerOnRedrawCurrentAndOtherPlayerTotalPoints;
            this.uiPlayer.RedrawPlayedCards += this.UiPlayerOnRedrawPlayedCards;
            this.uiPlayer.GameClosed        += this.UiPlayerOnGameClosed;
            this.uiPlayer.GameEnded         += this.UiPlayerOnGameEnded;

            IPlayer smartPlayer = new SmartPlayer();

            this.game = new SantaseGame(this.uiPlayer, smartPlayer);

            this.PlayerCard.Transparent();
            this.OldPlayerCard.Transparent();
            this.OtherPlayerCard.Transparent();
            this.OldOtherPlayerCard.Transparent();

            Task.Run(() => this.game.Start());
        }
コード例 #11
0
    private void AnimateThrow(RaycastHit throwTarget)
    {
        // Add a force to send the object towards the target
        SmartPlayer sp = targets[0].GetComponent <SmartPlayer>();

        if (sp != null)
        {
            sp.ThrowAnimation(rb, throwTarget);
        }
        else
        {
            rb.AddForce((transform.forward + transform.up * .01f) * throwForce);
        }

        // Set the state
        currState = (int)States.FLYING;
        offset    = Vector3.zero;
    }
コード例 #12
0
        public MainPage()
        {
            this.InitializeComponent();

            this.ProgramVersion.Text = "Santase v2.0";

            this.InitializeAdControl();

            this.resultPersister  = new TotalResultPersister();
            this.TotalResult.Text =
                $"{this.resultPersister.PlayerScore}-{this.resultPersister.OtherPlayerScore}";

            this.playerCardControls = new[]
            {
                this.PlayerCard1, this.PlayerCard2, this.PlayerCard3,
                this.PlayerCard4, this.PlayerCard5, this.PlayerCard6,
            };

            this.uiPlayer                  = new UiPlayer();
            this.uiPlayer.RedrawCards     += this.UiPlayerRedrawCards;
            this.uiPlayer.RedrawTrumpCard += this.UiPlayerRedrawTrumpCard;
            this.uiPlayer.RedrawNumberOfCardsLeftInDeck          += this.UiPlayerOnRedrawNumberOfCardsLeftInDeck;
            this.uiPlayer.RedrawPlayerPlayedCard                 += this.UiPlayerOnRedrawPlayerPlayedCard;
            this.uiPlayer.RedrawOtherPlayerPlayedCard            += this.UiPlayerOnRedrawOtherPlayerPlayedCard;
            this.uiPlayer.RedrawCurrentAndOtherPlayerRoundPoints +=
                this.UiPlayerOnRedrawCurrentAndOtherPlayerRoundPoints;
            this.uiPlayer.RedrawCurrentAndOtherPlayerTotalPoints +=
                this.UiPlayerOnRedrawCurrentAndOtherPlayerTotalPoints;
            this.uiPlayer.RedrawPlayedCards += this.UiPlayerOnRedrawPlayedCards;
            this.uiPlayer.GameClosed        += this.UiPlayerOnGameClosed;
            this.uiPlayer.GameEnded         += this.UiPlayerOnGameEnded;

            IPlayer smartPlayer = new SmartPlayer();

            this.game = new SantaseGame(this.uiPlayer, smartPlayer);

            this.PlayerCard.Transparent();
            this.OldPlayerCard.Transparent();
            this.OtherPlayerCard.Transparent();
            this.OldOtherPlayerCard.Transparent();

            Task.Run(() => this.game.Start());
        }
コード例 #13
0
        private int SimulateGamesAndGetSmartPlayerWins(int gamesToSimulate)
        {
            var smartPlayer     = new SmartPlayer();
            var smartPlayerWins = 0;

            var dummyPlayer = new DummyPlayer();

            var game = new SantaseGame(smartPlayer, dummyPlayer);

            for (var i = 0; i < gamesToSimulate; i++)
            {
                var winner = game.Start(i % 2 == 0 ? PlayerPosition.FirstPlayer : PlayerPosition.SecondPlayer);
                if (winner == PlayerPosition.FirstPlayer)
                {
                    smartPlayerWins++;
                }
            }

            // Console.WriteLine(smartPlayerWins);
            return(smartPlayerWins);
        }
コード例 #14
0
ファイル: BlankPlayer.cs プロジェクト: madddmax/jackal
 public virtual void OnNewGame()
 {
     player = new SmartPlayer();
     player.OnNewGame();
 }
コード例 #15
0
        // ReSharper disable once UnusedMember.Local
        private static ISantaseGame CreateGameVersusBot()
        {
            Console.BufferHeight = Console.WindowHeight = 17;
            Console.BufferWidth = Console.WindowWidth = 50;

            IPlayer firstPlayer = new ZatvorenoAI();
            IPlayer secondPlayer = new SmartPlayer();
            ISantaseGame game = new SantaseGame(firstPlayer, secondPlayer);
            return game;
        }