public ButtonViewModel(int row,int col,Game game) { this.game = game; pos = new Vector2D(row-1,col-1); Owner = game.Board[pos].Owner; IsValidMove = game.Board[pos].IsValidMove; Square = game.Board[pos]; click=new ClickCommand(this); }
public GameViewModel() { game = Game.CreateNew(); playerOneAI = Cell.Create(false); playerTwoAI = Cell.Create(false); playerOneAILevel = Cell.Create(0); playerTwoAILevel = Cell.Create(0); playerWithMostStones = game.PlayerWithMostStones; isGameOver = game.IsGameOver; currentPlayer = game.CurrentPlayer; createBoard(); StartAI(); }
public Square( Game game, Vector2D position ) { this.game = game; this.position = position; this.owner = Cell.Derived( () => game.GetOwnerAt( position ) ); this.isValidMove = Cell.Derived( () => game.IsValidMove( position ) ); }
public ViewModel(Game game) { this.game = game; rows = Enumerable.Range(1, 8).Select(i => new RowViewModel(i,this.game)).ToList().AsReadOnly(); ScorePlayer1=this.game.StoneCount(this.game.CurrentPlayer.Value); ScorePlayer2=this.game.StoneCount(this.game.CurrentPlayer.Value.Other); CurrentPlayer = this.game.CurrentPlayer; this.PlayerWithMostStones = this.game.PlayerWithMostStones; GameOver = this.game.IsGameOver; }
public RowViewModel(int row,Game game) { buttons = Enumerable.Range(1, 8).Select(i => new ButtonViewModel(row,i,game)).ToList().AsReadOnly(); }