scene.org File Archive

File download

<root>­/­mags­/­hugi­/­compos/hc22fin.zip

File size:
158 855 bytes (155.13K)
File date:
2004-08-24 23:10:03
Download count:
all-time: 2 106

Preview

  • atv/ dir
  • atv/16Jul2003.asm 8.86K
  • atv/boot_tet.asm 11.12K
  • atv/boot_tet.com 1.00K
  • atv/entry.com 363B
  • atv/tsr_tet.asm 16.06K
  • atv/tsr_tet.com 1.12K
  • boreal/ dir
  • boreal/25jul2003.asm 11.27K
  • boreal/entry.com 539B
  • chut/ dir
  • chut/19jul2003.asm 5.88K
  • chut/4c-02.exe 19.57K
  • chut/4c-02.pas 21.72K
  • chut/entry.com 533B
  • chut/example.com 899B
  • chut/keys.prg 1.16K
  • chut/piece.prg 3.27K
  • chut/showscr.prg 1.41K
  • E_I_/ dir
  • E_I_/26jul2003.asm 7.97K
  • E_I_/entry.com 441B
  • exophase/ dir
  • exophase/entry.asm 23.59K
  • exophase/entry.com 479B
  • g3/ dir
  • g3/24jul2003.asm 8.18K
  • g3/entry.com 359B
  • g3/matrix.asm 2.33K
  • g3/matrix.com 256B
  • hcompo22.zip 47.53K
  • pents.zip 18.10K
  • results.txt 439B
  • rules.txt 12.86K
  • sergo/ dir
  • sergo/25jul2003.asm 6.88K
  • sergo/entry.com 398B
  • sniper/ dir
  • sniper/entry.asm 14.05K
  • sniper/entry.com 837B
  • stewart/ dir
  • stewart/25jul2003.asm 10.72K
  • stewart/entry.com 367B
  • test/ dir

file_id.diz

The final results:

  Place  Handle, name, or Group       Size in bytes

   1      G3                            363
          ATV                           363
   3      Stewart                       367
   4      Sergo Polsky                  398
   5      E}I{                          441
   6      Exophase                      479
   7      Chut                          533
   8      Boreal                        539
          _
        _| |    _ _                           _ _ _ _        _
       |_  |   |   |      _ _     _ _       _|_ _ _ _|      | |_
       | |_|_ _|_ _|_    |  _|   |_  |     |  _|            |  _|
       | |  _|_  |  _|   | | |   | | |     | | |  _ _       |_| |
       | | |   | | |     |_| |_ _| |_|     |_| |_|   |       _| |
       |_|_|   |_|_|       |_ _|_ _|         |_ _|_ _|      |_ _|

                    s i z e   c o d i n g   c o m p o
                        _ _ _ _           _ _ _ _
                      _|  _|_  |_       _|  _|_  |_
                     |_ _|  _|_ _|     |_ _|  _|_ _|
                          _|  _|            _|  _|
                      _ _|_ _|          _ _|_ _|
                     |   |_ _ _ _      |   |_ _ _ _
                     |_ _|_ _ _ _|     |_ _|_ _ _ _|


Ladies and Gentlemen:

The task this time will be something very retro, something from the good
ol' days, something to show your grandchildren. And they already know it,
most likely from their Game Boys. You all know what I'm talking about, but
we dare not whisper the name, for the Tetris (tm) Company has not granted
us the right.

The Russian programmer Alexey Pajitnov invented this game of falling
tetrominoes in 1984. Tetrominoes, of course, are the shapes determined by
combinations of four adjacent squares.

    _ _       _ _     _ _ _     _ _       _ _ _ _     _ _ _     _ _ _
   |_|_|    _|_|_|   |_|_|_|   |_|_|_    |_|_|_|_|   |_|_|_|   |_|_|_|
   |_|_|   |_|_|         |_|     |_|_|               |_|         |_|


In the game these shapes fall down the screen to the bottom where they
are stacked. Keyboard commands manipulate them into (hopefully) nice neat
horizontal rows. Each completed row with no free square in it dissolves,
and any tetrominoes above it fall to fill in the missing row.

So, the challenge of our competition is to make this game in the smallest
piece of code that conforms to all the following picky little rules plus
the rules in GENERAL.TXT.

    _ _ _ _ _ _ _ 
_ _| The screen  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

To make the game attractive 256-color 320x200 graphics are used (i.e:
mode 13h).

The squares in a tetromino are drawn as 3D tiles with beveled edges. The
tiles are 8x8 pixels overall, with a one-pixel wide edge that is
highlighted on one side and shaded on the other. There is no space
between tiles in a tetromino.


                            °°°°°°°°°°°°°°²²
                            °°±±±±±±±±±±±±²²
             highlighted -->°°±±±±±±±±±±±±²²
                 edge       °°±±±±±±±±±±±±²²
                            °°±±±±±±±±±±±±²²
                            °°±±±±±±±±±±±±²²
                            °°±±±±±±±±±±±±²²<-- shaded edge
                            ²²²²²²²²²²²²²²²²
                              <--- 6 ---->
                            <----- 8 ------>


The tiles are colored depending on the tetromino they are in. The default
color palette is used. The palette registers are assigned to the center
of the tile, the highlighted edge and the shaded edge as follows:
          _ _       _ _     _ _ _     _ _       _ _ _ _     _ _ _     _ _ _
         |_|_|    _|_|_|   |_|_|_|   |_|_|_    |_|_|_|_|   |_|_|_|   |_|_|_|
         |_|_|   |_|_|         |_|     |_|_|               |_|         |_|
         blue    purple    violet     pink        red      orange    yellow
 center:  32       34        36        38          40        42        44
 hilite:  80       82        84        86          88        90        92
 shadow: 104      106       108       110         112       114       116

The tetrominoes fall down a 'well' represented by a 10x23 tile field plus
a one-tile border along its sides and bottom. Border tiles have these
colors:

 center:  52             _ _ _ _ _ _ _ _ _ _ _ _
 hilite: 100            |_|_|_|_|_|_|_|_|_|_|_|_|
 shadow: 124                      cyan

The well is centered on the screen.

Centered above the well is the score. Four digits are always displayed
with leading zeros. The BIOS font is used with normal white (7)
characters on a black (0) background. The entire screen is black except
where the score or a tile appear.


                                0000         ^
                            þ          þ  ^  |
                            þ          þ  |  |
                            þ          þ  |  |
                            þ          þ  |  |
                            þ          þ 23 25 lines = tiles
                            þ          þ  |  |
                            þ          þ  |  |
                            þ          þ  |  |
                            þ          þ  v  |
                            þþþþþþþþþþþþ     v
                             <-- 10 -->
                            <--- 12 --->
                                tiles


A correctly laid out well will have the upper-left corner of its upper-
left border tile at coordinate 112,8 (0,0 is the upper-left corner of the
screen). The lower-right pixel in the lower-right corner of the well will
be at 207,199.

    _ _ _ _ _ _
_ _| Game play |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

The game starts by initializing the score to 0000. One of the seven
tetrominoes is randomly selected and released at the top of the well. It
falls at a speed determined by the DOS system clock and the score.

While the tetromino is falling, it can be manipulated with these
keystrokes:

         'j'  - shift left
         'l'  - shift right
         'k'  - rotate
        space - drop at full speed

Within the confines of the well (or previously played tetrominoes) the
falling tetromino can be shifted left or right one tile width (8 pixels)
for each keystroke.

The falling tetromino also can be rotated 90 degrees counterclockwise per
keystroke. The center of rotation (+) for each tetromino is shown here:

       _ _       _ _     _ _ _     _ _       _ _ _ _     _ _ _     _ _ _
      |_|_|    _|+|_|   |_|+|_|   |_|+|_    |_|_|+|_|   |_|+|_|   |_|+|_|
      |_|_|   |_|_|         |_|     |_|_|               |_|         |_|


The first tetromino, the blue block, rotates about its center rather than
one of its tiles. The highlighted and shaded edges on tiles, of course,
don't rotate.

Tetrominoes are always confined to the inside of the well. A tetromino
cannot be rotated if any part of it would appear above the top of the
well. In effect there is an invisible barrier across the top of the well.

Tetrominoes are started at the top center of the well in the orientations
(rotations) shown above. The tetrominoes that are three tiles wide can't
be centered perfectly and are started with their centers of rotation (+)
offset to the right, or in the 6th empty column of the well. If the
tetromino cannot be placed at its starting position without overlapping a
previously played tetromino then the game is over.

Besides the keys used to manipulate the tetrominoes, these keystrokes are
also used:

        Esc   - terminates the program at any time
        space - starts the next game

Any other (undefined) keystrokes must be ignored; they must not do
anything. (Exceptions are system keystrokes such as Alt+Enter or Pause.)

Interrupt 16h function 0 must be used to read a keystroke; and function 1
must be used to detect if a keystroke is pending. This is required by the
test suite, which hooks this interrupt vector.

    _ _ _ _ _  
_ _| Scoring |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Points are scored by the height from which tetrominoes are dropped and
the number of completed rows that are collapsed by a single tetromino.

For each vertical tile position that a tetromino drops at full speed, one
point is awarded. (In other words, a point is given for each 8 pixels
that a piece falls after the spacebar is hit.)

Completed rows are awarded points on an increasing scale. It's possible
to collapse as many as four rows at once by dropping the long red piece
into a slot. Collapsing a single row is worth 20 points.

        Rows    Points
         1        20
         2        60
         3       140
         4       300

    _ _ _ _ _  
_ _| Timing  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

The speed of the game is regulated by the DOS system clock. Your entry
must use interrupt 1Ah function 0 to access the tick count. This is
necessary so that the test suite can stay synchronized.

The rate that tetrominoes initially fall is (10 - score/256) / 18.2
seconds. In other words, when the score is less than 256, the tetromino
falls one tile position (8 pixels) for every 10 ticks. When the spacebar
is hit, the drop rate increases to one tile position per tick. Completed
rows collapse at the same rate as the initial falling speed. If the
initial speed is one tile per 5 ticks then rows will collapse once per 5
ticks. You may assume that there is always at least one tick, or in other
words, that the score will never reach 2560.

    _ _ _ _ _ _ _
_ _| Randomness  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

The random numbers used to select the sequence of falling tetrominoes
must be generated by the following algorithm. Again this is required so
that the test suite can stay synchronized. This algorithm is short and
sweet, and is from "Master Class Assembly Language" by Wrox Press, page
840.

        mov     ax, seed  ;seed:= seed*9421 + 1
        mul     n9421
        inc     ax
        mov     seed, ax

        mov     dx, 0     ;randomNum:= remainder(seed/7)
        div     n7
;dx (the remainder) contains a random number from 0..6

;The initial value of the 'seed' is set when the program first starts
seed    dw      12345
n9421   dw      9421
n7      dw      7

    _ _ _ _ 
_ _| Steps |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Here are the steps that must be done. The order that keystrokes (in step
4) and waiting for timer ticks (in steps 5 and 7) must be followed so
that your entry will pass the test suite.

1: Set graphic mode 13h.
   Set score to 0000 (and display it).
   Set up empty well with tile borders on sides and bottom.

2: Randomly select one of seven tetrominoes.
   If it won't fit at the top of the well then go to 8.
   Display tetromino at top of well.

   Set speed_of_fall (in system clock ticks) to 10 - score/256.
3: Set timer to speed_of_fall.

4: If a keystroke is not waiting to be read in then skip to 5.
   Get keystroke (BIOS interrupt 16h).
   If key is Esc then go to 9.
   If key is 'j' then see if tetromino can be shifted one tile position left.
   If key is 'l' then see if it can be shifted one tile position right.
   If key is 'k' then see if it can be rotated counterclockwise 90 degrees.
   If there are no tiles in the way then erase tetromino from its present
     position and draw it in its new position.

5: Wait for a tick (BIOS interrupt 1Ah).
   Decrement timer.
   If spacebar was not hit and timer has not expired (not = 0) then go to 4.
   See if tetromino can shift down one tile position.
   If there are tiles already in this new position then go to 6.
   Erase tetromino from its present position.
   Draw tetromino in its new position.
   If the spacebar was pressed then increment the score (and display it).
   Go to 3.

6: Set 'points' to 20.
7: If there is no horizontal row full of tiles then go to 2.
   Remove row and move all tiles above it down one row.
   Add 'points' to score (and display result).
   Double 'points'.
   Wait for speed_of_fall number of ticks to elapse.
   Go to 7.

8: Get keystroke.
   If key is space (if spacebar was struck) then go to 1.
   If key is Esc then go to 9.
   Go to 8.

9: Restore mode 3 (80x25 text).
   Return to DOS (or Windows).

    _ _ _ _ _ _ _
_ _| Submitting  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Your entry file must be named "ENTRY.COM". Before submitting your entry
make sure it passes the test suite by running TEST.BAT.

Send your ENTRY.COM file along with its source code to this address:

                ------->>  fys@cybertrails.com  <<-------

You may submit updates to your entries any time until the deadline.

    _ _ _ _ _ _
_ _| Schedule  |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

2003-May-16: Compo 22 starts
2003-Jul-26 23:59:59 MST: Submission deadline
2003-Jul-27: Sourcepack will be released; public judgment starts
2003-Aug-02: End of public judgment; final results will be released

    _ _ _ _ _
_ _| Creditz |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Thanks goes to claw for writing the first draft of these rules and
getting this compo started. Boreal wrote the example program and revised
the rules to match. And of course a big THANKS goes to Sniper for testing
all the entries and posting the scores.

Have fun! Especially while testing. ;-)