dispatch method

void dispatch(
  1. String action
)

Implementation

void dispatch(String action) {
  switch (action) {
    case 'moveLeft':
      game.moveLeft();
      break;
    case 'moveRight':
      game.moveRight();
      break;
    case 'softDrop':
      game.softDrop();
      break;
    case 'hardDrop':
      game.hardDrop();
      break;
    case 'rotCW':
      game.rotateCW();
      break;
    case 'rotCCW':
      game.rotateCCW();
      break;
    case 'hold':
      game.holdPiece();
      break;
    case 'pause':
      game.togglePause();
      break;
    case 'resume':
      game.resume();
      break;
    case 'gravity':
      game.applyGravity();
      break;
    case 'lock':
      game.lockActivePiece();
      break;
  }
}