%%HP: T(3)A(D)F(.);
@ REVERSIT, by Paul Lancaster
DIR
  REVERSIT
    \<< CLEAR 0 0 'Y' STO 9 'X' STO "123456789" DUP 'Z' STO 1 10
      START RAND 9 * CEIL 'X' STO REV1
      NEXT { REVGO REVERSIT } MENU
    \>>
  REVGO
    \<< 'X' STO SWAP DROP REV1 Y 1 + 'Y' STO DUP DUP 'W' STO
      IF Z ==
      THEN 500 .5 BEEP Y
      ELSE Y SWAP 1 9
        FOR N W N N SUB STR\-> 200 * .2 BEEP
        NEXT
      END
    \>>
  REV1
    \<<
      IF X 1 ==
      THEN 'X' 1 STO+
      END DUP X 1
      FOR N DUP N N SUB SWAP -1
      STEP DROP 1 X 1 -
      START +
      NEXT SWAP X 1 + 9 SUB +
    \>>
  W 0
  X 0
  Y 0
  Z 0
  CST 0
END
