if grid = dirt,rock then action = dead
if grid = open then grid = open
if grid = open then
  if grid_down != dirt,rock,ladder then action = falling
  if button = down then 
    if joy = left,ul,dl then
      if grid_dl = dirt and grid_left = gold,open,rope,ladder then action = zap_l
      action = stop_l
    if joy = right,ur,dr then
      if grid_dr = dirt and grid_right = gold,open,rope,ladder then action = zap_r
      action = stop_r
    goto open_stop
  if joy = down,dl,dr and grid_down = ladder then action = climb_d
  if joy = left,dl,ul then
    if grid_left = rope then action = swing_l
    if grid_left = gold,open,ladder then action = run_l
    action = stop_l
  if joy = right,dr,ur then
    if grid_right = rope then action = swing_r
    if grid_right = gold,open,ladder then action = run_r
    action = stop_r
  open_stop:
  if action = zap_l,run_l,stop_l,swing_l,hang_l then action = stop_l
  if action = zap_r,run_r,stop_r,swing_r,hang_r then action = stop_r
  action = stop_l | stop_r
if grid = rope then
  if button = down then 
    if joy = left,ul,dl then
      if grid_dl = dirt and grid_left = gold,open,rope,ladder then action = zap_l
      action = hang_l
    if joy = right,ur,dr then
      if grid_dr = dirt and grid_right = gold,open,rope,ladder then action = zap_r
      action = hang_r
    goto rope_stop
  if joy = down then
    if grid_down = ladder then action = climb_d
    if grid_down = dirt,rock then goto rope_stop
    action = falling
  if joy = dl then
    if grid_down = ladder then action = climb_d
    goto rope_left
  if joy = dr then
    if grid_down = ladder then action = climb_d
    goto rope_right
  if joy = left,ul then
    rope_left:
    if grid_left = gold,open,rope,ladder then action = swing_l
    action = hang_l
  if joy = right,ur then
    rope_right:
    if grid_right = gold,open,rope,ladder then action = swing_r
    action = hang_r
  rope_stop:
  if action = zap_l,run_l,stop_l,swing_l,hang_l then action = hang_l
  if action = zap_r,run_r,stop_r,swing_r,hang_r then action = hang_r
  action = hang_l | hang_r
if grid = ladder then
  if button = down then 
    if joy = left,ul,dl then
      if grid_dl = dirt and grid_left = gold,open,rope,ladder then action = zap_l
      action = stop_ud
    if joy = right,ur,dr then
      if grid_dr = dirt and grid_right = gold,open,rope,ladder then action = zap_r
      action = stop_ud
    action = stop_ud
  if joy = down then
    if grid_down = dirt,rock then action = stop_ud
    action = climb_d
  if joy = up then
    if grid_up = gold,open,rope,ladder then action = climb_u
    action = stop_ud
  if joy = left then
    ladder_left:
    if grid_left = rope then action = swing_l
    if grid_left = gold,open,ladder then action = run_l
    action = stop_ud
  if joy = right then
    ladder_right:
    if grid_right = rope then action = swing_r
    if grid_right = gold,open,ladder then action = run_r
    action = stop_ud
  if joy = ul then
    if grid_up = gold,open,rope,ladder then action = climb_u
    goto ladder_left
  if joy = ur then
    if grid_up = gold,open,rope,ladder then action = climb_u
    goto ladder_right
  if joy = dl then
    if grid_up != dirt,rock then action = climb_d
    goto ladder_left
  if joy = dr then
    if grid_up != dirt,rock then action = climb_d
    goto ladder_right
  action = stop_ud
action = stop_ud

gold = $0F
open = $00
dirt = $B6
rock = $FF
rope = $40
ladder = $45
hole = $76,$36,$16,$0E,$06,$02,$01 **

