Project based on game 2048 I'm thinking about an assignment based around the game 2048. This would be towards the end of a first programming course at the university level and assumes the students have been introduced to at least two dimensional arrays, loops, conditionals and methods. The purpose is to have the students practice these skills.

I would represent the board as a two dimensional array of int.

I would require a method (e.g. merge(int[] row)) which does the work on an individual row of the puzzle when the move is to slide left. The idea is to encapsulate the work of a slide in a single, testable method. This also emphasizes that a two dimensional array is an array of array, and that one can work on a single row at a time.

What are your opinions on the following ideas:


Should a single move in the game be implemented as (move(direction)) or as individual methods (up() down() left() right())?
One idea for completing the game involves rotating the board by multiples of 90 degrees. Then a move can be implemented as a three step process:


Rotate board to one orientation
Slide all rows left (merge(board[row]) for each row
Rotate board back to original orientation

Another idea is to show them that move right can be implemented by the process


reverse a row
slide it left (merge(board[row])
reverse the row again
For columns, copy the values from a column into a one dimensional temp array, then perform the merge(temp) and then copy back to the board. This may also require reverses, depending on the up/down selection.

Require a method to produce a list of empty cells for use in picking the location of the next "insertion". This could be a list of int to demonstrate how a single index can map to a row/col using div and mod operations. Alternatively, it could be a list of pairs of row/column.
The last wrinkle is to decide what to actually stored in each board location. The simple answer is just the value. However, an interesting variation might be to store the log2 of the value. By doing this, you get an index that can be used to select, for example, the background color of each square of the board. This changes the logic of merge(), so that
combining adjacent cells ups the value by 1, rather than adding two values together.


Am I trying to put too many different concepts into this assignment? Your opinions and suggestions are appreciated.

Thanks
First of all, it seems like rather nice bones of a 2-dimensional array lab. It does not strike me as being too many things at all.


The interface is cleaner with move(direction), but the internal logic is cleaner divided into methods.  Why not the best of both words?  Provide them with starter code that will utilize private methods:

public void move(direction){
  switch(direction){
    case UP:
       slideUp();
    case DOWN:
       slideDown();
   case LEFT:
       slideLeft();
   case RIGHT:
       slideRight();
  }
}

That is another way, also valid.
It seems excessively finicky to require implementation details down to this level.
Once again, I would provide the interface, but not these sorts of implementation details.  You can provide both ways as suggestions, but leave it up to them.  They may also choose a third option that you have not mentioned.
This fits very nicely if you are providing some sort of GUI starter code, which would justify an implementation detail like this one.