protected void setupGame(Board board, Board.BoardSize size, int handicaps, IRuleSet rules) { this._board = board; this._rules = rules; this._spaces = new SpaceCollection(this, size); int[,] hcList = Rules.GetHandicaps(board.Game, handicaps); for (int x = 1; x <= this._spaces.Size; x++) { for (int y = 1; y <= this._spaces.Size; y++) { if (hcList[x - 1, y - 1] == 1) { this.AddStone(x, y, Space.Color.Black); } } } this._spaces.SpaceClick += _spaces_SpaceClick; if (handicaps > 1) { this.NextMove = Space.Color.White; } else { this.NextMove = Space.Color.Black; } this.History.Add((BasicGame)this.Copy()); this._historyIndex = 0; }
public SpaceCollection(Game game, Board.BoardSize size) { switch (size) { case Board.BoardSize.Nine: { this.setupCollection(game, 9); break; } case Board.BoardSize.Thirteen: { this.setupCollection(game, 13); break; } default: { this.setupCollection(game, 19); break; } } }
private void startNewGame() { NewGame dlg1 = new NewGame(); dlg1.ShowDialog(); if (dlg1.GameType == 1) { GameSetup dlg2 = new GameSetup(); if (dlg2.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this._boardSize = dlg2.BoardSize; this.Game = new LocalGame(this, dlg2.BoardSize, dlg2.Handicaps, dlg2.Rules); this.Game.StoneChanged += Game_StoneChanged; } else { if (this._game == null) { this._shouldClose = true; } } } else if (dlg1.GameType == 2) { } else { if (this._game == null) { this._shouldClose = true; } } this.SetStatus(); }
public LANGame(Board board, Board.BoardSize size, int handicaps, IRuleSet rules) { this.setupGame(board, size, handicaps, rules); }