示例#1
0
文件: Program.cs 项目: Shydos/gomoku
        public static void CheckVictory(Referee referee)
        {
            if (referee._winner != 0)
            {

            }
        }
示例#2
0
文件: Program.cs 项目: Shydos/gomoku
 public static void displayGrid(Referee referee)
 {
     for (int y = 0; y < 19; y++)
     {
         for (int x = 0; x < 19; x++)
         {
             System.Console.Write(referee._board.GetInterValue(new Position(x, y))._value + " ");
         }
     }
 }
示例#3
0
文件: Board.cs 项目: Shydos/gomoku
 public Board(Referee referee, bool isRuleBreakable, bool isRuleDoubleThree)
 {
     _referee = referee;
     _isRuleBreakable = isRuleBreakable;
     _isRuleDoubleThree = isRuleDoubleThree;
     breakableAlignList = new List<BreakableAlign>();
     _interBoard = new Intersection[19, 19];
     _byteBoard = new byte[91];
     for (int i = 0; i < 91; i++)
     {
         _byteBoard[i] = 0;
     }
     for (int x = 0; x < 19; x++)
     {
         for (int y = 0; y < 19; y++)
         {
             _interBoard[x, y] = new Intersection(new Position(x, y));
         }
     }
 }
示例#4
0
 public HumanPlayer(Referee myReferee, int numPlayer)
     : base(myReferee, numPlayer)
 {
 }
示例#5
0
文件: Program.cs 项目: Shydos/gomoku
        public void Start()
        {
            bool isRuleBreakable;
            bool isRuleDoubleThree;

            isRuleBreakable = true;
            isRuleDoubleThree = true;
            referee = new Referee(isRuleBreakable, isRuleDoubleThree, true);
            referee.Start();

            #region
            // TEST
            /*
            referee._board.SetInterValue(new Position(0, 0), 1);
            referee._board.SetByteValue(new Position(0, 0), 1);
            referee._board.SetInterValue(new Position(1, 1), 2);
            referee._board.SetByteValue(new Position(1, 1), 2);
            referee._board.SetInterValue(new Position(2, 2), 2);
            referee._board.SetByteValue(new Position(2, 2), 2);

            referee._board.SetInterValue(new Position(6, 1), 1);
            referee._board.SetByteValue(new Position(6, 1), 1);
            referee._board.SetInterValue(new Position(7, 1), 1);
            referee._board.SetByteValue(new Position(7, 1), 1);
            referee._board.SetInterValue(new Position(8, 1), 1);
            referee._board.SetByteValue(new Position(8, 1), 1);
            referee._board.SetInterValue(new Position(9, 1), 1);
            referee._board.SetByteValue(new Position(9, 1), 1);
            referee._board.SetInterValue(new Position(11, 1), 1);
            referee._board.SetByteValue(new Position(11, 1), 1);
            referee._board.SetInterValue(new Position(12, 1), 1);
            referee._board.SetByteValue(new Position(12, 1), 1);
            referee._board.SetInterValue(new Position(8, 0), 2);
            referee._board.SetByteValue(new Position(8, 0), 2);
            referee._board.SetInterValue(new Position(8, 2), 1);
            referee._board.SetByteValue(new Position(8, 2), 1);

            referee._board.SetInterValue(new Position(1, 4), 1);
            referee._board.SetByteValue(new Position(1, 4), 1);
            referee._board.SetInterValue(new Position(2, 4), 1);
            referee._board.SetByteValue(new Position(2, 4), 1);
            referee._board.SetInterValue(new Position(3, 4), 1);
            referee._board.SetByteValue(new Position(3, 4), 1);
            referee._board.SetInterValue(new Position(1, 6), 1);
            referee._board.SetByteValue(new Position(1, 6), 1);
            referee._board.SetInterValue(new Position(2, 6), 1);
            referee._board.SetByteValue(new Position(2, 6), 1);
            referee._board.SetInterValue(new Position(4, 6), 1);
            referee._board.SetByteValue(new Position(4, 6), 1);

            referee._board.SetInterValue(new Position(6, 7), 2);
            referee._board.SetByteValue(new Position(6, 7), 2);
            referee._board.SetInterValue(new Position(6, 10), 2);
            referee._board.SetByteValue(new Position(6, 10), 2);
            referee._board.SetInterValue(new Position(9, 7), 2);
            referee._board.SetByteValue(new Position(9, 7), 2);
            referee._board.SetInterValue(new Position(12, 7), 2);
            referee._board.SetByteValue(new Position(12, 7), 2);
            referee._board.SetInterValue(new Position(12, 10), 2);
            referee._board.SetByteValue(new Position(12, 10), 2);
            referee._board.SetInterValue(new Position(7, 8), 1);
            referee._board.SetByteValue(new Position(7, 8), 1);
            referee._board.SetInterValue(new Position(7, 10), 1);
            referee._board.SetByteValue(new Position(7, 10), 1);
            referee._board.SetInterValue(new Position(8, 9), 1);
            referee._board.SetByteValue(new Position(8, 9), 1);
            referee._board.SetInterValue(new Position(8, 10), 1);
            referee._board.SetByteValue(new Position(8, 10), 1);
            referee._board.SetInterValue(new Position(9, 8), 1);
            referee._board.SetByteValue(new Position(9, 8), 1);
            referee._board.SetInterValue(new Position(9, 9), 1);
            referee._board.SetByteValue(new Position(9, 9), 1);
            referee._board.SetInterValue(new Position(10, 9), 1);
            referee._board.SetByteValue(new Position(10, 9), 1);
            referee._board.SetInterValue(new Position(10, 10), 1);
            referee._board.SetByteValue(new Position(10, 10), 1);
            referee._board.SetInterValue(new Position(11, 8), 1);
            referee._board.SetByteValue(new Position(11, 8), 1);
            referee._board.SetInterValue(new Position(11, 10), 1);
            referee._board.SetByteValue(new Position(11, 10), 1);
            */
            #endregion

            displayGrid(referee);
            while (true)
            {
                Debug.Log("Player " + referee._playerPlaying._numPlayer + " (" + referee._playerPlaying._nbToken + "/10 tokens)");
                if (referee._playerPlaying is HumanPlayer)
                {
                    Debug.Log("Enter coordonee with the format : \"x y\"");
                    String coord = System.Console.ReadLine();
                    char[] delimiters = { ' ' };
                    string[] words = coord.Split(delimiters);
                    Position newPos = new Position(Int32.Parse(words[0]), Int32.Parse(words[1]));
                    referee._lastPos = newPos;
                }
                referee.Update();
                if (referee._boardChanged)
                {
                    displayGrid(referee);
                    CheckVictory(referee);
                }
            }
        }
示例#6
0
文件: AIPlayer.cs 项目: Shydos/gomoku
 public AIPlayer(Referee myReferee, int numPlayer)
     : base(myReferee, numPlayer)
 {
     _ai = new AI(_referee._board);
 }
示例#7
0
文件: Player.cs 项目: Shydos/gomoku
 public Player(Referee referee, int numPlayer)
 {
     _referee = referee;
     _numPlayer = numPlayer;
     _nbToken = 0;
 }