\ Rolling dice by setting dots on OLED screen

hex  chere

: DOT       ( flag y x -- ) \ Eight character dot
    6 umin >r  70 umin
        dup  r@    xy" Q11P"
             r> 1+ xy" O11N" ;

: ONE       &page  3C 3 dot ;
: TWO       &page  54 0 dot  24 6 dot ;
: THREE     two  3C 3 dot ;
: FOUR      two  54 6 dot  24 0 dot ;
: FIVE      four  3C 3 dot ;
: SIX       four  24 3 dot  54 3 dot ;

: DICE      ( +n -- )
    dup 1 = if  one     then
    dup 2 = if  two     then
    dup 3 = if  three   then
    dup 4 = if  four    then
    dup 5 = if  five    then
        6 = if  six     then ;

: DO-DICE   6 choose 1+ dice ;

: TESTDICE      ( -- )
    setup-i2c  setup-random
    display-setup  &page
    0 1 >xy s" Rolling dice" &&type
    0 4 >xy s"     test" &&type
    800 ms  &page
    begin
        20 choose D + 0 do  do-dice  C ms  loop  800 ms
    key? until
    &page ;

chere swap - dm u.

shield DICE\  freeze
