public boolean edit( int X, int Y ){
    boolean flag = super.edit(X,Y);
    if( !flag ){
      X -= LabyrinthDrawer.MARGIN;
      Y -= LabyrinthDrawer.MARGIN;
      int x = X/LabyrinthDrawer.CELL_SIZE;
      int y = Y/LabyrinthDrawer.CELL_SIZE;
      switch( option ){
        case AGENT:
          setAgentPosition( x, y, 0 );
        break;
        case TREASURE:
          if( (structure[tx][ty] & (1<<4)) == (1<<4) )
            structure[tx][ty] ^= (1<<4);
          structure[x][y] ^= (1<<4);
          tx = x;
          ty = y;
        break;
        case RESOURCE:
          structure[x][y] ^= (1<<5);
          structure[x][y] |= (31<<6);
          structure[x][y] &= resource;
        break;
      }
    }
    return flag;
  }