コード例 #1
0
ファイル: SixNimmtHarness.cs プロジェクト: nattress/tichu_ml
        static SixNimmtGameState CreateNewGame(Random random, double[] scores, bool proMode)
        {
            SixNimmtDeck      deck  = SixNimmtDeck.Create(random);
            SixNimmtGameState state = SixNimmtGameState.Create(random, deck, PlayerCount, proMode);

            if (scores != null)
            {
                state.SetInitialScores(scores);
            }

            for (int player = 0; player < PlayerCount; player++)
            {
                for (int i = 0; i < 10; i++)
                {
                    state.DealCard(player, deck.DealCard());
                }
            }

            state.SetCurrentPlayer(0);

            // Give each row a starting card
            for (int i = 0; i < SixNimmtGameState.BoardRowCount; i++)
            {
                state.AddStartingCard(i, deck.DealCard());
            }

            return(state);
        }
コード例 #2
0
        static SixNimmtGameState CreateNewGame(Random random, double[] scores, bool proMode)
        {
            SixNimmtDeck      deck  = SixNimmtDeck.Create(random);
            SixNimmtGameState state = SixNimmtGameState.Create(random, deck, PlayerCount, proMode);

            if (scores != null)
            {
                state.SetInitialScores(scores);
            }

            // Get pov player's hand
            while (true)
            {
                Console.WriteLine("Enter hand (ie, '1 3 43 104')");
                string   handInput  = Console.ReadLine();
                string[] handInputs = handInput.Split(" ");
                if (handInputs.Length != 10)
                {
                    Console.WriteLine($"Enter 10 cards. I counted {handInputs.Length}");
                    continue;
                }

                for (int i = 0; i < handInputs.Length; i++)
                {
                    state.DealCard(0, int.Parse(handInputs[i]));
                }
                break;
            }

            state.SetCurrentPlayer(0);

            while (true)
            {
                Console.WriteLine("Enter starting row cards top to bottom (ie, '43 32 45 98')");
                string   rowsInput  = Console.ReadLine();
                string[] rowsInputs = rowsInput.Split(" ");
                if (rowsInputs.Length != SixNimmtGameState.BoardRowCount)
                {
                    Console.WriteLine($"Enter {SixNimmtGameState.BoardRowCount} cards. I counted {rowsInputs.Length}");
                    continue;
                }

                for (int i = 0; i < SixNimmtGameState.BoardRowCount; i++)
                {
                    state.AddStartingCard(i, int.Parse(rowsInputs[i]));
                }
                break;
            }

            return(state);
        }