Example #1
0
 public void Reset(Game other)
 {
     Array.Copy(other._numbers, _numbers, 16);
 }
Example #2
0
 public bool Equals(Game other)
 {
     for (int i = 0; i < BoardHeight; ++i)
         for (int j = 0; j < BoardWidth; ++j)
             if (Numbers[i, j] != other.Numbers[i, j]) return false;
     return true;
 }
Example #3
0
 public Game(Game other)
 {
     Array.Copy(other._numbers, _numbers, 16);
     //Range(0, 4).ForEach(i => Range(0, 4).ForEach(j => _numbers[i, j] = other._numbers[i, j]));
     //ResetTransformation();
 }
Example #4
0
 public int Coherence()
 {
     var directions = new Direction[] { Direction.Up, Direction.Left, Direction.Right, Direction.Down };
     var game = new Game(this);
     int ret = int.MinValue;
     foreach (var direction in directions)
     {
         ret = Math.Max((int)game.Update(direction).MergedCount, ret);
         for (int i = 0; i < 4; ++i)
             for (int j = 0; j < 4; ++j)
                 game.AddCellTrivial(i, j, _numbers[i, j]);
     }
     return ret;
 }