scene.org File Archive

File download

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

File size:
80 314 bytes (78.43K)
File date:
2004-08-28 23:07:34
Download count:
all-time: 2 135

Preview

  • _rules/ dir
  • _rules/example.ASM 8.56K
  • _rules/example.COM 576B
  • _rules/general.txt 10.29K
  • _rules/manifest.txt 1.37K
  • _rules/rules.txt 7.71K
  • _rules/test.a16 33.62K
  • _rules/test.com 2.90K
  • _rules/ttt1.EXE 5.28K
  • _rules/ttt1.PAS 5.44K
  • _rules/ttt2.EXE 5.33K
  • _rules/ttt2.htm 6.19K
  • _rules/TTT2.PAS 5.04K
  • _rules/ttt_test.EXE 9.97K
  • _rules/TTT_TEST.PAS 12.04K
  • atv/ dir
  • atv/entry.asm 7.06K
  • atv/entry.com 221B
  • boiled/ dir
  • boiled/entry.asm 9.22K
  • boiled/entry.com 214B
  • bonz/ dir
  • bonz/entry.asm 4.07K
  • bonz/entry.com 239B
  • boreal/ dir
  • boreal/entry.asm 6.47K
  • boreal/entry.com 239B
  • chut/ dir
  • chut/entry.asm 5.22K
  • chut/entry.com 282B
  • exophase/ dir
  • exophase/entry.asm 6.25K
  • exophase/entry.com 277B
  • jeff/ dir
  • jeff/entry.asm 3.03K
  • jeff/entry.com 238B
  • meph/ dir
  • meph/entry.a16 8.71K
  • meph/entry.com 274B
  • results.txt 575B
  • sergo/ dir
  • sergo/entry.asm 3.94K
  • sergo/entry.com 213B
  • sniper/ dir
  • sniper/entry.asm 7.72K
  • sniper/entry.com 264B
  • stewart/ dir
  • stewart/entry.asm 6.57K
  • stewart/entry.com 216B

file_id.diz

=============================================================================
            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

                            g e n e r a l   i n f o
=============================================================================

---------------------------------- [RULES] ----------------------------------

Unless stated otherwise in the competition specific rules, your entry must
  ... follow the competition specific rules.
  ... have the filename "entry.com".
  ... work in a Windows95 DOS box.
  ... work on the Adok's PC. an Intel Pentium 600, 64 MByte RAM,
      running Windows 98 [Version 4.10.2222].
  ... use only instructions up to i586 (Pentium).

Unless stated otherwise, your entry must NOT
  ... depend on its file name, i.e. it still has to work after renaming
      it to, say, FOOBAR.EXE, or any other valid DOS executable file name.
  ... depend on its drive or path.
  ... crash unless where explicitly stated by the rules.
  ... use MMX instructions or other non-Pentium instructions like CMOVcc;
      look at the "x86.txt" file for further information.
  ... use the special registers CR0..4 (this includes the MSW), DR0..7, or 
      RDMSR/WRMSR instructions.
  ... use any external files or create new files on the disk.
  ... rely on any previously loaded code or data in memory, excluding
      DOS itself.
  ... disable interrupts for longer than 1/50 second in a row on
      a 200MHz Pentium.
  ... have been modified by means of an executable-packer (i.e., entry.com
      must be the product of assembling entry.asm).

You may assume that
  ... the registers have these values (all in hex):
      (xx - means an unknown value which MUST NOT be assumed)

          EAX = xxxx****
                AL = 00 if first FCB has valid drive letter,  FF if not
                AH = 00 if second FCB has valid drive letter, FF if not
          EBX = xxxx0000
          ECX = xxxx00FF
          EDX = xxxxxxxx
  DX  = CS = DS = ES = SS = xxxx, 0080 <= DX <=9000.
          ESI = xxxx0100
          EDI = xxxxFFFE
          EBP = xxxx09xx
          ESP = xxxxFFFE
          EIP = xxxx0100

  EFLAGS (binary) = xxxxxxxx xxxxxxxx xxxx0x1x xx0x0x1x
      i.e.
          DF = 0
          IF = 1
          other flags = x

          WORD [FFFE] = 0000
          Layout of PSP: see [Memory Layout]

  ... that the program is not loaded high.
  ... that DPMI services are available.
  ... FCB functions can be used to access files whose name is given in 8.3
      format.

You must NOT assume that
  ... the  FPU  state is  defined;  you have to use  FINIT  to  initialize it
      before using it.

If you use other's people code (from previous compos or the like), please
add a comment about this to your code, including a reference to the original
program. Oh yes, and please comment your code.

------------------------------ [MEMORY LAYOUT] ------------------------------

The PSP is a copy of a buffer containing the history of command line
arguments. You can assume that all preceding command line arguments were
smaller than 100 bytes. That is:
  PSP:[E5h] = 0Dh or 0
  PSP:[E6h]...[FFh] = 0

Format of Program Segment Prefix (PSP) (located at initial DS:0000):
[according to Ralf Brown's Interrupt List]

Offset  Size    Description     (Table 01378)
00h  2 BYTEs   INT 20 instruction for CP/M CALL 0 program termination
                the CDh 20h here is often used as a signature for a valid PSP
02h    WORD    segment of first byte beyond memory allocated to program
        note: do not assume that this word contains 0A000h
04h    BYTE    (DOS) unused filler
05h    BYTE    CP/M CALL 5 service request (FAR CALL to absolute 000C0h)
06h    WORD    CP/M compatibility--size of first segment for .COM files
08h  2 BYTEs   remainder of FAR JMP at 05h
0Ah    DWORD   stored INT 22 termination address
0Eh    DWORD   stored INT 23 control-Break handler address
12h    DWORD   DOS 1.1+ stored INT 24 critical error handler address
16h    WORD    segment of parent PSP
18h 20 BYTEs   DOS 2+ Job File Table, one byte per file handle, FFh = closed
2Ch    WORD    DOS 2+ segment of environment for process (see #01379)
2Eh    DWORD   DOS 2+ process's SS:SP on entry to last INT 21 call
32h    WORD    DOS 3+ number of entries in JFT (default 20)
34h    DWORD   DOS 3+ pointer to JFT (default PSP:0018h)
38h    DWORD   DOS 3+ pointer to previous PSP (default FFFFFFFFh in 3.x)
3Ch    BYTE    DOS 4+ (DBCS) interim console flag (see AX=6301h)
3Dh    BYTE    (APPEND) TrueName flag (see INT 2F/AX=B711h)
3Eh  2 BYTE    ?
40h  2 BYTEs   DOS 5+ version to return on INT 21/AH=30h
42h  7 BYTE    ?
49h    BYTE    unused by DOS versions <= 6.00
4Ch    WORD    ?
4Eh  2 BYTEs   unused by DOS versions <= 6.00
50h  3 BYTEs   DOS 2+ service request (INT 21/RETF instructions)
53h  2 BYTEs   unused in DOS versions <= 6.00
55h  7 BYTEs   unused in DOS versions <= 6.00; can be used to make first FCB
                  into an extended FCB
5Ch 16 BYTEs   first default FCB, filled in from first commandline argument
                overwrites second FCB if opened
6Ch 16 BYTEs   second default FCB, filled in from second commandline argument
                  overwrites beginning of commandline if opened
7Ch  4 BYTEs   unused
80h 128 BYTEs  commandline / default DTA
                command tail is BYTE for length of tail, N BYTEs for the tail,
                  followed by a BYTE containing 0Dh

-------------------------------- [CHECKING] ---------------------------------

Usually, there is a test suite provided with the competition rules, which is
irregularily updated; new versions can be found at

                      http://www.hugi.de/compo/

However, the test suites usually only serve as a GUIDE, so please check your
program against the rules before submitting. Also be aware that the test
suite itself may contain bugs; if you find one, please send an e-mail about
it to Adok (cdvolko@gmx.net) or (preferred) to the compo mailinglist (see
below).

------------------------------- [SUBMISSION] --------------------------------

You have to send

  - the sourcecode of your entry
  - the executable of your entry ("entry.com")

to Adok so that he can analyse and evaluate your entry.

Send your entries to:
                         cdvolko@gmx.net

It would be best if you could submit your entry as early as possible. Then
Adok can inform you about bugs, if he finds any, and you have enough time to
fix them. Attention: if he finds no bugs, this doesn't automatically mean
that your entry is bug-free; see also CHECKING (above).

You can submit updates to your entries all the time till the deadline.

Entries that do not agree with these rules will be disqualified. Their coders
will be informed about the mistake, and they can re-submit a bugfixed version
unless the compo is over.

Only one entry per coder can qualify; if two or more coders work together on
a single entry, it will count as a joint entry for those coders; no other
entries of these coders can qualify. Note that the entry will count as a
entry of this group of coders for the world league table.

----------------------------- [PUBLIC JUDGEMENT] ----------------------------

After the deadline for entry submission, as soon as the entries and the beta
results are released, the public judgement starts. During this week you can
discuss and object to the entries that seem to break some rule. Please send
your objections to the compo-mailinglist (see below). Adok and/or a jury
formed by him will check if your objections are according to the rules.

If a hidden flaw is found in one of the originally accepted entries during
the public judgement period, public judgement will decide what to do with the
entry. Possible consequences include disqualification and penalties.

------------------------------- [PRE-RESULTS] -------------------------------

Preliminary results of this compo will be released on the compo-web-site and
always updated after receiving a new entry. In this way the compo will
hopefully be exciting.

Compo-web-site URL:
                     http://hugi.de/compo/

---------------------------------- [PRIZES] ---------------------------------

I'm sorry if I disappoint you, but there are no material prizes. Everything
is just a matter of fun, honor and fame. Moreover, the 30 best competitors
will get points and be listed in the 'World League Table of Assembly'
situated at the compo-web-site. Reaching a good place at a compo and even
more in the World League Table of Assembly is a good visiting-card and
recommendation for every competitor!

------------------------------ [MAILING LIST] -------------------------------

The purpose of the Hugi Compo mailing list is to inform about new compos and
provide a discussion forum for the competitors. At the moment there are about
220 subscribers.

To subscribe send a mail to hugi-compo-subscribe@yahoogroups.com. You'll get
an automatically generated mail which confirms your subscription within a few
hours. Then you start getting the mails the others have posted to this
mailinglist. You will have to subscribe to write mails to the mailinglist.

Mails for the list have to be sent to:
        hugi-compo@yahoogroups.com

If you want to subscribe, send a mail to:
        hugi-compo-subscribe@yahoogroups.com

If you want to unsubscribe, send a mail to:
        hugi-compo-unsubscribe@yahoogroups.com

The mailing list archive can be found at
        http://www.egoups.com/groups/hugi-compo/

-------------------------------- [ADDRESSES] --------------------------------

Send your entries to:
                                            cdvolko@gmx.net   [Adok/Hugi]
Compo-homepage (pre-results, world league table, test suites etc.):
                                                    http://hugi.de/compo/
Subscribe to the mailing list:
                                     hugi-compo-subscribe@yahoogroups.com
Unsubscribe from mailing list:
                                   hugi-compo-unsubscribe@yahoogroups.com
Mailing list archive:
                            http://www.yahoogroups.com/groups/hugi-compo/

-----------------------------------------------------------------------------

Thanks for reading this file!

Original rules by Adok
Extended and revised by INT-E

,---------------------------------------------------------------------
| HUGI COMPO 21 TEST SUITE AND EXAMPLES
| by Bonz and Boreal (in alphabetic order) :-)
| version 1.02
`---------------------------------------------------------------------

History
----------------------------------------------------------------------

Changes from v.1.00 to v.1.01
- added TTT2.* example that shows the AI's reasonings
- added INT 20h hooking to the test suite
- added more error explanation to the test suite (e.g.
  "incorrect move" is separated from "screen error")

Changes from v.1.01 to v.1.02
- fixed severe bug that crippled the test suite (did not
  correctly find out if the computer was losing)


File list
----------------------------------------------------------------------
EXAMPLE.ASM	example tic-tac-toe program (source)
EXAMPLE.COM	example tic-tac-toe program (binary)

TTT1.PAS	Pascal example doing recursive evaluation (source)
TTT1.EXE	Pascal example (binary)

TTT2.PAS	Pascal example doing static evaluation (source)
TTT2.EXE	Pascal example (binary)
TTT2.HTM	Javascript example with user interface (tested with
		IE5; Konqueror and Mozilla should be also ok)

TTT_TEST.PAS	Test suite (source)
TTT_TEST.EXE	Test suite (binary)

GENERAL.TXT	Generic rules valid for all Hugi compos
RULES.TXT	Ruleset specific to this compo
MANIFEST.TXT	This file :-)
 Â  Â        þ   ÚÄÄ¿þ           ÚÄÄ¿       ¿þ           ÚÄÄ¿
 ÃÄÄ´¿  ÂÚÄÄ¿Â   ÀÄÄ¿ÂÚÄÄ¿ÚÄÄ¿   ³   ÚÄÄ¿ÚÄÄ´ÂÚÄÄ¿ÚÄÄ¿   ³   ÚÄÄ¿Ú¿ Ú¿ÚÄÄ¿ÚÄÄ¿
 ³  ³³  ³³  ³³   ³  ³³   ³ÃÄÄÙ   ³  ³³  ³³  ³³³  ³³  ³   ³  ³³  ³³ÀÅÙ³³  ³³  ³
 Á  ÁÀÄÄÁÀÄÄ´Á   ÀÄÄÙÁ ÄÄ´ÀÄÄ    ÀÄÄÙÀÄÄÙÀÄÄÙÁÀ  ÀÀÄÄ´   ÀÄÄÙÀÄÄÙÀ Á ÙÃÄÄÙÀÄÄÙ
         ÀÄÄÙ         ÀÄÄÙ                        ÀÄÄÙ                Á

                        ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿       ÚÄÄÄÄÄÄÄÄ¿
                     ÚÄÄÙÛÛÛÛÛÛÛÛÛÛÛÛÛÀÄ¿ ÚÄÄÄÙÛÛÛÛÛÛÛÛ³                   
                     ³ÛÛÛÛÛÛ ÂÄ  ÛÛÛÛÛÛÛ³ ³ÛÛÛÛÛÛÛÛÛÛÛÛ³                  
                     ÀÄÄÄÄÄÂÄÙ ÛÛÛÛÛÛÛÚÄÙ ÀÄÄÄ¿ÛÛÛÛÛÛÛÛ³                   
                        ÚÄÄÙ²²²²²²²ÚÄÄÙ       ³²²²²²²²²³                  
                     ÚÄÄÙ±±±±±±± ÄÄÁÄÄÄÄ¿ ÚÄÄÄÙ±±±±±±±±ÀÄÄÄ¿                  
                     ³°°°°°°°°°°°°°°°°°°³ ³°°°°°°°°°°°°°°°°³                  
                     ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ                   


                                   T ³ I ³ C
                                  ÄÄÄÅÄÄÄÅÄÄÄ
                                   T ³ A ³ C
                                  ÄÄÄÅÄÄÄÅÄÄÄ
                                   T ³ O ³ E


Welcome to the Hugi Size Coding Compo number 21.

This time the task is to code the small game called "Tic-Tac-Toe". Not
only is the game small, but your program should be too. The winner of the
compo is the one who codes the smallest implementation of the following
rules. Have fun!


   ³   ³
ÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄ
   ³   ³ Description  ³
ÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄ  Ä
   ³   ³   

The game is known in all parts of the world, but by various names. In
England it's "noughts and crosses". In Germany it's called "cheese-boxes".
Americans call it "tic-tac-toe".

The original name was "tit-tat-toe", which made sense. "Tit for tat" is a
retaliation, and "toe" supports the first two, for three in a row. "Tit"
was probably changed to "tic" with an eye toward political correctness.

The game was played in Egypt over 3500 years ago, and by now probably
everyone has caught on. (But just in case:) A field is divided into 3x3
parts. Two players take turns placing their sign into any of the nine
free parts. The goal is to get three of your signs in a row; either
horizontally, vertically or diagonally.


   ³   ³
ÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄ
   ³   ³ The Program  ³
ÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄ  Ä
   ³   ³   

The computer program you are to write competes against a human player.
This means you've got to implement some kind of "artificial intelligence"
(AI). Specifically it means that your program must be smart enough that
it never loses a game. What kind of algorithm you implement is your
choice.

The player makes a move by pressing the key on the numeric keypad that
corresponds to one of the nine positions in the playfield.

                              ÚÄÄÄÂÄÄÄÂÄÄÄ¿
                              ³ 7 ³ 8 ³ 9 ³
                              ÃÄÄÄÅÄÄÄÅÄÄÄ´
                              ³ 4 ³ 5 ³ 6 ³
                              ÃÄÄÄÅÄÄÄÅÄÄÄ´
                              ³ 1 ³ 2 ³ 3 ³
                              ÃÄÄÄÁÄÄÄÅÄÄÄÙ
                              ³ 0     ³
                              ÀÄÄÄÄÄÄÄÙ

The player always gets to go first, but the 0 key is used to skip a move.
Thus it can be used to let the computer play first.

The Esc key is used to terminate the program.

All of the other keys must be ignored, except the other numeric keys on
the top row. Num Lock must be on.

BIOS interrupt 16h function 0 must be used to read a character from the
keyboard. This is required so that your program can be verified with the
test suite.


   ³   ³
ÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄ
   ³   ³ The Screen   ³
ÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄ  Ä
   ³   ³   

The playfield is drawn using the box character set like this: 

                                  ³   ³
                               ÄÄÄÅÄÄÄÅÄÄÄ
                                  ³   ³
                               ÄÄÄÅÄÄÄÅÄÄÄ
                                  ³   ³

(For you poor Windoze users without an OEM font, it's a big version of
this: #.) The box characters are the extended ASCII characters B3h (³),
C4h (Ä) and C5h (Å).

The signs are a nought and cross, which are displayed as an uppercase "O"
and "X". They are drawn in the centers of the nine positions of the play-
field. The player marks moves with the "X" and the computer uses the "O".

The 40x25 text screen (mode 1) is used. The playfield is centered on the
21st column and 13th row. The flashing cursor must be turned off
(typically using interrupt 10h function 1). When the program terminates,
the normal 80x25 text screen (mode 3) and the flashing cursor must be
restored. (Interrupt 10h function 0 is sufficient to do both.)

When a game is finished, a message must declare the winner. For example,
if the computer wins, "O wins!" is displayed. If nobody wins, "A draw!"
is displayed. All messages are centered below the playfield, starting
in the 18th column and 21st row.


   ³   ³
ÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄ
   ³   ³ The Steps    ³
ÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄ  Ä
   ³   ³   

Here are the steps that must be done:

    Switch to 40x25 text screen (mode 1)
 0: Clear the screen
    Turn off the flashing cursor
    Draw the playfield (#)

 1: Wait for then read a keystroke using interrupt 16h, function 0
    If it's an Esc (1Bh) then go to 4
    If it's a 0 then skip to 2
    If it's not 1 thru 9 then go back to 1
    If the position is already occupied then go back to 1

    Draw an "X" in the specified position
    If there are three X's in a row then display "X wins!" and go to 3
    If there are no more moves available then display "A draw!" and go to 3

 2: Generate the computer's move
    Draw an "O" in the position it plays
    If there are three O's in a row then display "O wins!" and go to 3
    If there are no more moves available then display "A draw!" and go to 3
    Go to 1

 3: Wait for a keystroke
    If it's not an Esc then go to 0
 4: Restore 80x25 text screen (mode 3) and the flashing cursor
    Return to DOS

See GENERAL.TXT for additional rules and assumptions.


   ³   ³
ÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄ
   ³   ³ Submitting   ³
ÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄ  Ä
   ³   ³   

Before submitting your entry make sure it passes the test suite by
running TTT_TEST ENTRY.COM (A blank screen for several minutes is
normal.)

Send your entries to this address:

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

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


   ³   ³
ÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄ
   ³   ³ Schedule     ³
ÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄ  Ä
   ³   ³   

2003-Feb-09: Compo 21 starts
2003-Mar-15 23:59:59 MST: Submission deadline (beware of the Ides of March)
2003-Mar-16: Sourcepack will be released, public judgment starts
2003-Mar-23: End of public judgment, final results will be released


   ³   ³
ÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄ
   ³   ³ Creditz      ³
ÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄ  Ä
   ³   ³   

A big THANKS to Bonz for writing the test suite and making this compo
happen. Thanks also goes to Sniper for volunteering to be the host.
Thanks claw for writing these rules. Boreal gets credit for editing the
rules and for the assembly language example. The fancy fonts were stolen
from TAD. Adok, thank you for being our inspiration. Finally, thanks goes
to all you competetors who make these compos worthwhile.

Have fun!


Beta Results of HC21.

 1. Sergo Polsky      Russia            213
 2. Boiled Brain      Belarus           214
 3. Stewart           UK                216
 4. ATV               Finland           221
 5. Jeff              US of A           238
 6. Bonz              Italy             239
 6. Boreal            US of A           239
 8. claw/Sniper       Germany/US of A   264
 9. meph              Germany           274
10. Exophase          US of A           277
11. Chut              Hungary           282

Thanks to all who participated.

Sniper