Exemple #1
0
        public void InputDataSet()
        {
            for (int n = 0; n < dataSetNum; n++)
            {
                TurnStatus turn     = new TurnStatus();
                int        outCount = 0;

                while (true)
                {
                    string str = Console.ReadLine();

                    turn.events.Add(turn.GetEvent(str));

                    if (turn.GetEvent(str) == TurnStatus.Event.Out)
                    {
                        outCount++;
                    }

                    if (outCount >= 3)
                    {
                        break;
                    }
                }
                turns.Add(turn);
            }
        }
Exemple #2
0
        private void ProcessTurn(TurnStatus turn)
        {
            int outCount = 0;

            foreach (TurnStatus.Event ev in turn.events)
            {
                #if DEBUG
                Console.WriteLine(ev);
                Console.WriteLine(turn.bases);
                Console.WriteLine("this: " + turn.bases);
                #endif

                switch (ev)
                {
                case TurnStatus.Event.Hit:
                    turn.bases = (turn.bases << 1) + 1;
                    if (turn.baseStatus[turn.bases] == TurnStatus.BaseStatus.HTSF)
                    {
                        turn.score++;
                        turn.bases = turn.bases >> 1;
                    }
                    break;

                case TurnStatus.Event.Homerun:
                    turn.score += (int)turn.baseStatus[turn.bases] + 1;
                    turn.bases  = 0;
                    break;

                case TurnStatus.Event.Out:
                    outCount++;
                    break;
                }
                #if DEBUG
                Console.WriteLine(turn.baseStatus[turn.bases] + " " + turn.bases);
                #endif
                if (outCount >= 3)
                {
                    break;
                }
            }
        }