 move = (board, direction) ->
   newBoard = buildBoard()
   for i in [0..3]
-    if direction is 'right' or direction is 'left'
+    if direction in ['right', 'left']
       row = getRow(i, board)
       row = mergeCells(row, direction)
       row = collapseCells(row, direction)
       setRow(row, i, newBoard)
-    else if direction is 'up' or direction is 'down'
+    else if direction in ['up', 'down']
       column = getCol(i, board)
       column = mergeCells(column, direction)
       column = collapseCells(column, direction)

        else if cell[b] isnt 0 then break
    cell

  if direction is 'right' or direction is 'down'
    merge cell
  else if direction is 'left' or direction is 'up'
    merge(cell.reverse()).reverse()

collapseCells = (cell, direction) ->
  cell = cell.filter (ele) -> ele isnt 0
  while cell.length < 4
    if direction is 'right' or direction is 'down'
      cell.unshift 0
    else if direction is 'left' or direction is 'up'
      cell.push 0
  cell


  true

noValidMove = (board) ->
  for direction in ['up', 'down', 'left', 'right']
    newBoard = move(board, direction)
  if moveIsValid(board, newBoard)
    return false
  true
