All pastes #899556 Raw Edit

Mine

public text v1 · immutable
·published 2008-02-11 06:15 UTC
rendered paste body
class MyWorld extends World {
  Board b;
  
  MyWorld(Board b) {
    this.b = b;
  }

  // the world is unchanged by clock ticks
  public World onTick() {
    return this;
  }
  
  // create a new world with the shape moved on a valid keystroke
  public World onKeyEvent(String in) {
     return ((in.equals("1")
        ? b.makeMove(1)
        : (in.equals("2")
           ?b.makeMove(2)
           : (in.equals ("3")
              ? b.makeMove(3)
              : (in.equals ("4")
                 ? b.makeMove(5)
                 : b)))));
  }

  // draw the world
  public boolean draw(){
    return b.draw(this.theCanvas);
  }
}