public IGame Shift(int value) { var valueLocation = this.GetLocation(value); var zeroLocation = this.GetLocation(0); if (!(valueLocation.X == zeroLocation.X && Math.Abs(valueLocation.Y - zeroLocation.Y) == 1) && !(valueLocation.Y == zeroLocation.Y && Math.Abs(valueLocation.X - zeroLocation.X) == 1)) { throw new GameException($"Near chip {value} is not empty place."); } var newRecord = new GameHistoryRecord(value, zeroLocation, valueLocation); return(new GameWithMemory(newRecord, this)); }
private GameWithMemory(GameHistoryRecord record, IGame baseGame) { this.record = record; this.baseGame = baseGame; }