// 2011.07.28 # Doj
// Для удобства описания уровней

// лениво писать нормальный алгоритм :)
: try-food-generate
  maze-x @ random maze-y @ random 
  2dup maze[]@ 32 <> if 2drop false exit then
  2dup in-snake? if 2drop false exit then
  10 random 97 + rrot maze[]! food+ true
;

: food-generate 100 random 0= food# 2 < and if
                  10 begin dup 0> try-food-generate not and while 1- repeat drop
                then ;

variable *enter_food
*enter_food off
" 
dup enter_ a
dup enter_ b
dup enter_ c
dup enter_ d
dup enter_ e
dup enter_ f
dup enter_ g
dup enter_ h
dup enter_ i
dup enter_ j
drop
" *enter_food b!

variable *draw_food
*draw_food off
" 
dup draw_ a
dup draw_ b
dup draw_ c
dup draw_ d
dup draw_ e
dup draw_ f
dup draw_ g
dup draw_ h
dup draw_ i
dup draw_ j
drop
" *draw_food b!

: enter_food *enter_food b@ evaluate ;
: draw_food *draw_food b@ evaluate ;
