Beispiel #1
0
        public void Action(Board board)
        {
            while (true)
            {
                Console.WriteLine("");
                if (board.GetPutPositions(this.stone).Count() < 1)
                {
                    Console.WriteLine("あなたは置けなかったのでパス");
                    return;
                }

                ShowPosition(board);

                Console.WriteLine("置く位置を入力してください>>> ");

                (int x, int y)input = Input();
                var IsNotRange = !board.IsBoardRange(input);
                if (IsNotRange || board.FindReverseStones(input, this.stone).Count() < 1)
                {
                    Console.WriteLine("そこは置けません。");
                    continue;
                }

                IEnumerable <(int x, int y)> reverseList = board.FindReverseStones(input, this.stone);
                this.Put(board, (input.x, input.y)); // 指定した場所に置く
                foreach (var pos in reverseList)
                {
                    this.Put(board, pos);
                }

                return;
            }
        }
Beispiel #2
0
        public void Action(Board board)
        {
            IEnumerable <(int x, int y)> positions = board.GetPutPositions(this.stone);

            if (positions.Count() < 1)
            {
                Console.WriteLine("cpuは置けなかったのでパス");
                return;
            }

            // 置ける場所の中からランダムに選ぶ
            var position = positions.ToList()[this.ran.Next(positions.Count() - 1)];

            Console.WriteLine($"CPUは({position.x}, {position.y})に置いた");

            IEnumerable <(int x, int y)> reverseList = board.FindReverseStones(position, this.stone);

            this.Put(board, position);
            foreach (var pos in reverseList)
            {
                this.Put(board, pos);
            }
        }