/// <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(); }
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); }
/// <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]; } }
/// <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]; } } }
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); } }
/// <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(); } }
public static string PlaceToken(string board) { var reversiBoard = new ReversiBoard(board); return(reversiBoard.GetBestPlace(FieldStateEnum.O, FieldStateEnum.X)); }
public ReversiPanel(ReversiBoard board) : this(board, "32") { }
public ReversiGame(ReversiBoard board) { Board = board; Board.FieldClick += BordOnFieldClick; }
public void New(ref ItemsControl display, ref TextBlock scores) { Board = new ReversiBoard(); scores.DataContext = Board; display.ItemsSource = Board.Squares; }
public ReversiPanel(ReversiBoard board) : this(board, "32"){}