// 2011.07.29 # Doj

// ñóïåð åäà
variable *super-food-x
variable *super-food-y
:noname  COLOR 2dup PURPLES GEN[]2 ^ set-color 
         30 size->global draw-sized-cell ; draw_ .
:noname  2dup passed 
         2dup COLOR PURPLES GEN[]2 ^ true 30 snake+ 
         32 rrot maze[]! 
         food- ate+ ; enter_ .

:noname  player-y! player-x! ;oninit_ S
:noname  ;init
:noname  
  food-generate 
  1000 random 0= if 46 *super-food-x @ *super-food-y @ maze[]! then
  200 snake# 3 * - *MIN_STEP_DELTA !
;after-update

24 constant FOOD_SIZE

: draw_#  COLOR 2dup ÒÐÀÂÀ GEN[]2 ( ÒÐÀÂßÍÎÉ-ÇÅË¨ÍÛÉ) ^ set-color draw-cell-rect ;
:noname  draw_# ;draw_ #

40 constant exit-length
:noname  snake# exit-length > if 2drop else draw_# then ;draw_ F
:noname  snake# exit-length > if [ *prev @ ] literal next else stopped then ;enter_ F

:noname  COLOR 2dup BROWNS GEN[]2 ^ set-color 
         FOOD_SIZE size->global draw-sized-cell ;
draw_food

:noname  2dup passed 
         2dup COLOR BROWNS GEN[]2 ^ true FOOD_SIZE snake+ 
         32 rrot maze[]! 
         food- ate+ ;
enter_food

:noname  *super-food-y ! *super-food-x ! ; oninit_ s

variable *1x
variable *1y
variable *2x
variable *2y

:noname  *1y ! *1x ! ; oninit_ 3
:noname  *2y ! *2x ! ; oninit_ 4

:noname  2drop *2x @ *2y @ teleport ; enter_ 1
:noname  2drop *1x @ *1y @ teleport ; enter_ 2

:noname  COLOR ÖÈÀÍ ^ set-color draw-cell-rect ; 
dup draw_ 1
dup draw_ 2
drop

lab 
###################################
#                                 #
#                                 #
#      S      a  b  c             #
#                                 #
#   #####    ##     ##    #####   #
#   #####    ##     ##    #####   #
#      ##    ##  s  ##    ##      #
#     31#    ##     ##    #24     #
#      ##    ##     ##    ##      #
#   #####    #########    #####   #
#   #####    #########    #####   #
#                                 #
#                                 #
################FF#################
\lab
maze!
centrize
