     key = e.which #event.which is a function in jquery which returns which key you pressed
     keys = [37..40]
     if key in keys
-      #e.preventDefault()
+      e.preventDefault()
       direction = switch key #the switch function switches the value based upon conditions
         when 37 then 'left'
         when 38 then 'up'

  @board = buildBoard()
  generateTile(@board)
  generateTile(@board)
  showBoard(@board)

  $('body').keydown (e) => #where keydown is the event and everything after (e) is the event handler

    if direction is 'right'
      row = getRow(i, board)
      mergeCells(row, direction)
      collapseCells(row, direction)


getRow = (r, board) ->
  [board[r][0], board[r][1], board[r][2], board[r][3]]

mergeCells = (row, direction) ->
  #to merge the cells we need to know the rows and the direction
  #this is a double for loop which iterates over all the possible comparisons within the array
  if direction is 'right'
    for a in [3...0]
      for b in [a-1..0]
