static void Main() { Console.Title = "2048 Game. Keys - Up, Down, Right, Left."; DR game = new DR(); game.Run(); }
private bool Update(Direction dir) { ulong score; bool isUpdated = DR.Update(this.Board, dir, out score); this.Score += score; return(isUpdated); }
private bool IsDead() { ulong score; foreach (Direction dir in new Direction[] { Direction.Down, Direction.Up, Direction.Left, Direction.Right }) { ulong[,] clone = (ulong[, ])Board.Clone(); if (DR.Update(clone, dir, out score)) { return(false); } } return(true); }
private void Display() { Console.Clear(); Console.WriteLine(); for (int i = 0; i < nRows; i++) { for (int j = 0; j < nCols; j++) { using (new ColorOutput(DR.GetNumberColor(Board[i, j]))) { Console.Write(string.Format("{0,6}", Board[i, j])); } } Console.WriteLine(); Console.WriteLine(); } Console.WriteLine("Score: {0}", this.Score); Console.WriteLine(); }