"The Boxing Match" - The January 1994 Programmer Of The Month (POTM) contest. (deadline is midnight of New Year's Day, Sat. 1/1/94) -------------------------------- THIS IS A SAMPLE ARENA. 32x16 SPOTS. -------------------------------- (WITH A FEW (o) YOU CAN'T USE) -----o-------------------------- -------------------------------- YOUR WEAPONS ARE SQUARE BOXES: 1x1, 2x2, -------------------------------- 3x3, 4x4, .... through 16x16 -------------------------------- -------------------------------- YOUR OPPONENTS HAVE THE SAME WEAPONS. ----------------o--------------- ---------------o-o-------------- ON YOUR TURN, YOU CAPTURE ONE BOX WORTH ------------------o------------o OF UNUSED ARENA - THEN YOUR OPPONENTS DO --oo---------------o------------ THE SAME ON THEIR TURN ... --oo---------------------------- --oo---------------------------- IF YOU CAPTURE THE LAST SPOT - YOU WIN. -------------------------------- -------------------------------- YOU PLAY, HEAD-TO-HEAD, AGAINST OTHER ------------------------------oo ENTRANTS - CAN YOU BEAT THEM???? <---- 32 wide ----> ( 16 tall ) ============================================================================ ====== THE REST OF THIS MAIL CONTAINS DETAILS ... IF THIS DOESN'T ========== === SOUND LIKE FUN, FEEL FREE TO STOP READING .. I WILL NOT BE OFFENDED! === ============================================================================ The game details: 1. THE ARENA: is 32x16 and remains 32x16 always; has vacant (available) spots marked with "-"s (hyphens, dashes, minus signs - ya know, THAT thing); has unavailable spots marked with something else: a) "o" (lower case letter o) to denote unavailable spots on the original arena board - the number and location of these unavailable spots is up to me and may change for each game; b) YOUR "mark" indicating that you occupied this spot on an earlier move. c) some other character to indicate a move made by another player during a previous turn, probably a letter or a number - but maybe not. 2. THE PLAY: consists of occupying a square box on the arena board by marking it with your "mark", at least ONE spot must be marked on your turn - unless the arena is already full; you may occupy any size square box on your turn, from 1x1 up to 16x16; your move may cover ONLY previously unoccupied spots (those currently containing a "-"). 3. WINNING: if you fill in the last vacant spot on the arena board, you win the game. ====================================== SCORING .... 1. If you fill the last vacant spot on the arena board, you will be awarded with a WIN. Your SCORE will be the number of your MARKS on the final board (which may be more or less than your opponents!). 2. For each game, all players who do not WIN will be awarded a ZERO SCORE! Note that there will be two players per game in Stage 1, but there may be more players in a Stage 2 game. 3. The judging will take place in two stages: Stage 1: I will define three different starting arenas (X,Y,Z). Your entry will play six games against every other entry I receive - one on one, head to head. There will be two games in each arena, one where you go first and one where you go second. This "match" of six games will result in you having some number of WINS (0-6) and some SCORE (0-2979??) Stage 1 - making the cut! After everyone has had a "match" with everyone else, stage one is complete. I will count up everyone's WINS. (If I get N entries, you will play 6*(N-1) games against the other (N-1) participants ...) That entry with the most WINs will win the POTM! IF two (or more) entries have the same number of WINs, the entry with the highest total SCOREs will win the POTM. IF two (or more) entries have the same number of WINs AND the same total SCORE ... then (and only then) will I need Stage 2 - with luck I can avoid it!!! Stage 2 - FOR ONLY THOSE ENTRIES WITH THE HIGHEST WINs AND SCOREs DURING STAGE ONE !!! I will define a single arena (X) for stage 2. If there are N entries left at this stage, I will run a game that allows all N to play in sequence. In fact, I will run N! (N factorial) such games so that every possible order of play is accounted for. Again - most WINs will win, after that the highest total SCORE will be used as a tiebreaker only. If there are STILL ties - I'll slash my wrists and award duplicate cash "prizes" to those still involved! ====================================== SAMPLE PARTIAL GAME .... oAAAAA-----BBBBBBBBBBB--BBBBBBBB We start off with 20 unusable spots ("o") -AAAAA-----BBBBBBBBBBB--BBBBBBBB 1. player "A" marks a 9x9 box (lower left) -AAAAA-----BBBBBBBBBBB-oBBBBBBBB 2. player "B" takes an 8x8 at the top right -AAAAA-----BBBBBBBBBBB--BBBBBBBB 3. player "A" answers with 5x5 at top left -AAAAAooo--BBBBBBBBBBB--BBBBBBBB 4. player "B" finds an 11x11 --AAAAAAAAABBBBBBBBBBB--BBBBBBBB 5. player "A" sticks a 6x6 near the bottom --AAAAAAAAABBBBBBBBBBBo-BBBBBBBB right --AAAAAAAAABBBBBBBBBBB--BBBBBBBB --AAAAAAAAABBBBBBBBBBB----AAAAAA Who will win the battle? ya know, I ooAAAAAAAAABBBBBBBBBBB----AAAAAA don't know! The player that covers -oAAAAAAAAABBBBBBBBBBB----AAAAAA the last vacant spot will claim victory! --AAAAAAAAA---------------AAAAAA --AAAAAAAAA------------o--AAAAAA --AAAAAAAAA---------------AAAAAA oooo-------------------------ooo -----------------------------ooo ====================================== YOUR PROGRAM .... 0. NAME IT SOMETHING CLEVER ... NOT BORING ... YOU MUST NAME YOUR PROGRAM ... BOXING.C is "NOT" CLEVER ... 1. Your executable (call it a.out) will be executed as follows: cat old.arena | a.out A > new.arena where: a.out takes ONE single character argument ... which is the MARK it is to make (A in the example). a.out gets the current arena from standard input a.out writes the updated arena on standard output Note that you should be able to test your program by running it against itself repeatedly ... as follows: cat start.arena | a.out A | a.out B | a.out A | a.out B > 4move.arena ^ ^ ^ ^ don't forget: ARG 1 is the MARK to use! PLEASE DO THIS YOURSELF AS A FORM OF MINIMAL TESTING !!!! 2. Each time a.out runs, it should mark a new box (of any size) onto the arena described in the standard input - following the game rules and using the MARK in arg1 to mark the new square - and then place the resulting arena on standard output. Only one move per execution, and each move MUST legally place a square box of some size greater than zero. The only exception is described in rule three. 3. If there are NO vacant spots on the arena presented in the standard input, then copy the input to standard output without modification. When this occurs, the game is obviously over! 4. Both the input file and output file (stdin and stdout) should have exactly 528 characters in it: 32x16=512 plus 16 "\n" new-lines. (In other words, a simple editable file - no tricks!) The ONLY difference between the input and output is a square box marked with the character given by argument one - in spots that were previously marked with "-"s. 5. Your entry may use a temporary file over the course of the game to keep track of information between your MOVES in a game. This file MUST be located in /tmp and be named arena.{ARG1} (where ARG1 is the MARK your program uses to mark its moves). I will remove the file after every game. The following is illegal (as is anything that defeats the intent of these rules): a) you cannot use any other files (besides /tmp/arena.{ARG1}) to save ANY information b) you cannot read or tamper with an opponents file c) you cannot save information between games The intent is to allow you to deduce some strategy from the history of moves your opponent(s) have made thus far in the CURRENT game. Abuse of this rule will cause disqualification (please don't make me look!) 6. If your program takes more than one second per move - I will probably throw it away - maybe - if I feel like it ... don't push the limit ... particularly on the early moves! The rule will be flexible, since the target machine is uncertain ... if it runs in a second per move on YOUR machine, I'll probably accept it. ============================= HOW TO ENTER =========================== 1. For those of you who previously participated - there may be a mid-POTM change - the POTM will may no longer be run on an Amdahl - it may be run on a SparcStation 2 running Solaris 2.2 - or maybe on a Sequent ... but continue to send your mail to homxb!fah or uuto to homxb!fah. If I do need to make this change - I'll keep everyone informed and do the best I can to work through the porting issues! 2. You send me source code .... if I can get it to compile then you are in ... I will go to all reasonable lengths to get it to compile (debug runs, test programs, whatever). 3. Send your entry to homxb!fah or attmail!hicinbothem via email - [OR] (if you are able), I'd prefer: uuto entry.source homxb!fah 4. One entry per email address ... your most recent entry is the one that will count. Enter early to get the portability issues worked out - then resend as often as you wish. 5. There will be a weekly list of entrants circulated to anyone who enters. This status-board will contain email addresses and names of the folks who have entered thus far. Talking is allowed, but alliances are NOT allowed - you gotta use the same strategy against all opponents. But of course, you wouldn't even have CONSIDERED it ..... TH-TH-TH-THAAAAAAATTTTT'S ALL FOLKS. =Fred homxb!fah attmail!hicinbothem