Inheritance: System.Windows.Forms.PictureBox
Example #1
0
        /// <summary>
        /// ゲーム開始の処理
        /// </summary>
        private void GameStart()
        {
            this.board = new ReversiBoard(option.board_width, option.board_height);

            this.panel.Board = this.board;

            this.ClientSize = new Size(this.panel.Width, this.panel.Height + this.status_bar.Height);

            this.phase = ReversiColor.Black;
            ShowPhaseMessage();
        }
Example #2
0
		public ReversiPanel(ReversiBoard board, string image_name)
		{
			none_image  = System.Drawing.Image.FromFile(@"image\" + image_name + "n.png");
			white_image = System.Drawing.Image.FromFile(@"image\" + image_name + "w.png");
			black_image = System.Drawing.Image.FromFile(@"image\" + image_name + "b.png");

			this.board = board;
			if(board != null)
				CreateCells();
			else
				this.Size = new Size(0, 0);
		}
Example #3
0
		/// <summary>
		/// 盤面のコピーを作成するコンストラクタ
		/// </summary>
		/// <param name="b">コピー元</param>
		protected ReversiBoard(ReversiBoard b)
		{
			this.width = b.width;
			this.height = b.height;
			//盤面用のメモリ確保
			this.board = new ReversiColor[b.width+2, b.height+2];//周りに番兵を置くので+2
			//盤面の淵以外をNoneにクリア
			for(int x=0; x<b.width+2; ++x)
				for(int y=0; y<b.height+2; ++y)
				{
					this.board[x, y] = b.board[x, y];
				}
		}
Example #4
0
 /// <summary>
 /// 盤面のコピーを作成するコンストラクタ
 /// </summary>
 /// <param name="b">コピー元</param>
 protected ReversiBoard(ReversiBoard b)
 {
     this.width  = b.width;
     this.height = b.height;
     //盤面用のメモリ確保
     this.board = new ReversiColor[b.width + 2, b.height + 2];        //周りに番兵を置くので+2
     //盤面の淵以外をNoneにクリア
     for (int x = 0; x < b.width + 2; ++x)
     {
         for (int y = 0; y < b.height + 2; ++y)
         {
             this.board[x, y] = b.board[x, y];
         }
     }
 }
Example #5
0
        public ReversiPanel(ReversiBoard board, string image_name)
        {
            none_image  = System.Drawing.Image.FromFile(@"image\" + image_name + "n.png");
            white_image = System.Drawing.Image.FromFile(@"image\" + image_name + "w.png");
            black_image = System.Drawing.Image.FromFile(@"image\" + image_name + "b.png");

            this.board = board;
            if (board != null)
            {
                CreateCells();
            }
            else
            {
                this.Size = new Size(0, 0);
            }
        }
Example #6
0
        /// <summary>
        /// 対人戦時、セル(x,y)がクリックされたときの処理
        /// </summary>
        protected void OnCellClick(int x, int y)
        {
            if (!this.board.Check(x, y, this.phase))
            {
                return;
            }

            this.board[x, y] = this.phase;
            this.panel.UpdateBoard();
            this.phase = ReversiBoard.InverseColor(this.phase);
            ShowPhaseMessage();
            if (!this.board.CheckAll(this.phase))
            {
                GameSet();
            }
        }
Example #7
0
        public static string PlaceToken(string board)
        {
            var reversiBoard = new ReversiBoard(board);

            return(reversiBoard.GetBestPlace(FieldStateEnum.O, FieldStateEnum.X));
        }
Example #8
0
 public ReversiPanel(ReversiBoard board) : this(board, "32")
 {
 }
Example #9
0
 public ReversiGame(ReversiBoard board)
 {
     Board             = board;
     Board.FieldClick += BordOnFieldClick;
 }
Example #10
0
 public void New(ref ItemsControl display, ref TextBlock scores)
 {
     Board = new ReversiBoard();
     scores.DataContext  = Board;
     display.ItemsSource = Board.Squares;
 }
Example #11
0
		public ReversiPanel(ReversiBoard board) : this(board, "32"){}
Example #12
0
		/// <summary>
		/// ゲーム開始の処理
		/// </summary>
		private void GameStart()
		{
			this.board = new ReversiBoard(option.board_width, option.board_height);

			this.panel.Board = this.board;

			this.ClientSize = new Size(this.panel.Width, this.panel.Height + this.status_bar.Height);

			this.phase = ReversiColor.Black;
			ShowPhaseMessage();
		}