2048 Kode Java
private void verticalMove( int row, int col, String direction )
{
Tile initial = board[border][col];
Tile compare = board[row][col];
if ( initial.getValue() == 0 || initial.getValue() == compare.getValue() )
{
if ( row > border || ( direction.equals( "down" ) && ( row < border ) ) )
{
int addScore = initial.getValue() + compare.getValue();
if ( initial.getValue() != 0 )
{
score += addScore;
}
initial.setValue( addScore );
compare.setValue( 0 );
}
}
else
{
if ( direction.equals( "down" ) )
{
border--;
}
else
{
border++;
}
verticalMove( row, col, direction );
}
}
Cute Capybara