
           h u g i   s i z e   c o d i n g   c o m p e t i t i o n

                   infofile by adok, english version - v1.2


hi all.

after  taking  part in the pain size coding  compo  #2 i was fascinated by the
idea of making a similar competition in hugi (a diskmag).

now  i had to find a topic that one  the one hand makes it possible to write a
strongly   optimized  program.  on  the  other  hand  the  program  should  be
inspirating  and interesting. after some time  i finally decided to assign you
the following task:


                               +++ the task +++

you have to code a simple variant of the nibbles-game.

the  field  where the game takes place is  supposed to be bounded by a border,
which  has  to enclose the whole 320x200-pixel  screen.  in the inside of this
border  a  "snake"  is  supposed  to grow,  whose  size  is  one  pixel at the
beginning.

after starting the program, the snake's size shall grow one pixel more in each
repetition  of the program's main-loop. the direction in which the snake first
grows can be chosen by the programmer. by pushing given keys on the keyboard's
numerical pad, the direction in which the snake grows can be changed. the goal
of  the game is to control the snake's  growth-direction in such a way that it
will  neither touch the border nor bite itself for a as long as possible time.
if one of these two events occurs, the program shall be exited.

in  this  competition you are supposed to try  to create an exe- or a com-file
whose  size is as small as possible. the  winner will be the one whose com- or
exe-file has the smallest number of bytes.

the  current  pre-results  of  this  compo  will  be  released  on my homepage
(http://adok.home.pages.de) and always updated after receiving a new entry. in
this way i hope to make the compo exciting.

you have to send me

- the sourcecode and
- the executable

of your entry so that i can analyse and evaluate it.


                           +++ example-program +++

to  get  an impression what your program has  to look like, take a look at the
example-program   nibbles.exe.  if  it's  missing,  you  can  download  it  at
http://www.geocities.com/siliconvalley/bay/6062/nibbles.zip.   i   wrote   the
program  in c and "de-optimized" it intentionally so that nobody might get the
idea to run it in a debugger in order to use it in his own entry afterwards.

because  of reasons everyone understands i  recommend you to write the program
in assembler. at the moment the size of my assembler-version of nibbles, which
i wrote after the c-version, is 87 bytes, and i didn't even try to optimize it
yet. i myself won't participate in this compo. otherwise someone might get the
wrong idea that i rip off the best ideas and use them in my own entry.


                                +++ steps +++

1. switch to screen-mode 13h (320x200, 256 colors).

2. draw the border. the color of this border can be chosen by you. however, it
   must  not  be 0. the border has  to enclose the whole screen. therefore the
   coordinates of the corners are: (0/0), (319/0), (319/199), (0/199).

3. main-loop. the following tasks have to be processed:

   a) put a pixel at the current position of the snake-head. the color of  the
      pixel  that is set in the first repetition  of the loop can be chosen by
      you.  it  can be different from the  color  of the following pixels. all
      following pixels, however, have to be in the same color.

   b) keyboard-handler.  the  snake can  grow  in  four different  directions:
      upwards,  downwards, leftwards and rightwards. this growth-direction has
      to  be  chosen by the player with  the  following keys of the keyboard's
      numerical pad:

      upwards.......8
      downwards.....2
      leftwards.....4
      rightwards....6

      when  one  of these keys has been  pushed, the snake grows in the chosen
      direction.  it  grows in this direction  until  another of these keys is
      pushed.

      the program doesn't have to react if an "illegal" key has been pushed.

   c) growth of the snake. the position where  the next pixel will be put  has
      to be calculated by the program.

   d) delay, using the vertical retrace. to guarantee that every entry has the
      same speed use the following program-code:

      mov dx,3dah
      delay_l1:
       in al,dx
       test al,8
       jne delay_l1
      delay_l2:
       in al,dx
       test al,8
       je delay_l2

   e) check whether the snake has crashed  against the border or bited  itself
      (biting  oneself means touching one of  the pixels that was put before).
      if  yes: continue the program's execution at  step 4. if no: repeat step
      3.

4. switch to screen-mode 3 (textmode).

5. exit program without crashing.


                               +++ address +++

send your entries to adok.

e-mail: hugi@netway.at


                               +++ homepage +++

i'll publish the current pre-results of the compo on this homepage.

http://adok.home.pages.de


                            +++ miscellaneous +++

deadline is may 30th, 1998, 11:59 pm.

the final results will be published on my homepage and in hugi #11.

there are no prizes - everything is just a matter of fame and honor. :) in any
case,  reaching  a  good place at a  compo  is  an excellent visiting-card and
recommendation   for   every   competitor.  i'm   looking   forward   to  your
participation!

                                                      - adok, april 11th, 1998
