Prev: Holiday Game
Next: HLA v2.2 is now available
From: Benjamin David Lunt on 22 Sep 2009 10:25 "Rod Pemberton" <do_not_have(a)nohavenot.cmm> wrote in message news:h9af3n$2tb$1(a)aioe.org... > "Benjamin David Lunt" <zfysz(a)frontiernet.net> wrote in message > news:O9Rtm.60807$4t6.60741(a)newsfe06.iad... >> >> Well, that's not fair. Suppose to send me the >> .asm and .com files, not post it to the group. :-) >> > > I don't have a submission. I may or may not. I didn't complete the other > one I tried. But since you were hosting this one, I was going to ask > about > that. I don't have an email account available. And, I'd rather not set > one > up... Hi, I wonder how you could post it then. Do you have a web page? There are many free upload sites, though they may need an account too. Just like an email account. If you wanted to, wait until the day after the deadline for the competition, then post it here. I will include it in the results. Ben
From: Frank Kotler on 22 Sep 2009 15:01 io_x wrote: Hi... "io_x"(???), Rosario, that's you isn't it? What would you prefer to be called? >> We have started a new competition at >> http://www.frontiernet.net/~fys/hugi/hcompo.htm .... > if i understand well > this is my try (195 byte) Cool! But this isn't fair - to *you*! I can steal your code, trim a byte out of it, and submit it as my own work! While I appreciate the importance of "competition", I also recognize the importance of "cooperating to solve problems". So, "just for fun"... I haven't yet looked at the rules, the algorithm, the example programs, etc. I suspect 195 bytes isn't even close - these guys are *good*! They go by names like "Boiled Brain" and stuff... may not be an entirely good thing to be that good! :) Anyway, just some untested thoughts on how this might be made shorter... > ; m2m m.m m.asm > ;com file > ;nasmw -o m.com m.asm > > org 100h > Start: > push bx > push si > push di > push bp Would pusha work here? > ; in si la stringa > sub sp, 128 Might help to specify "byte" here- or use the "-Ox" switch... (there are a number of places where "byte" might help, so "-Ox" might be easier). Or it might be shorter to *not* use the stack - "section .bss" is "free" in a .com file. > mov ah, 0 > int 01ah > mov [seed], dx > mov di, sp > mov si, sp ; line in the stack > mov word[di+46], 0A0Dh > mov byte[di+48], 0 ; here 0D_0A_00 line > xor bp, bp > mov dx, -1 > jmp short .2 > .1: call rand > mov dx, ax > call WriteLine1 > call rand > mov dx, ax > cmp bp, 5 > jne .2 > mov dx, -1 > .2: call WriteLine > inc bp > cmp bp, 5 > jbe .1 > add sp, 128 > pop bp > pop di > pop si > pop bx > ret > > rand: > mov dx, 30721 > mov ax, [seed] > mul dx > add ax, 13971 > and ax, 0FFFCh > and dx, 3 ; passo gli ultimi 2 bits di r in a > or ax, dx > mov [seed], ax > ret > > outputLine: > mov di, si > mov ah, 0Eh > .1: mov al, [di] > cmp al, 0 > je .z > inc di > int 10h > jmp short .1 > .z: > ret "movsb" might be shorter... have to switch to using si... which might screw up something else... > ; in dx ci sono i 16 bit > ; che rappresentano 16 pezzi > ; di muro (1==c'�, 0==non c'�) > WriteLine: > mov cx, 15 > mov di, si > .1: mov byte[di], '+' > jcxz .3 > mov word[di+1], "--" > test dx, 1 > jnz .2 > mov word[di+1], " " > .2: dec cx > add di, 3 > shr dx, 1 > jmp short .1 > .3: call outputLine > .z: > ret > > ; in dx ci sono i 16 bit > ; che rappresentano 16 pezzi > ; di muro (1==c'�, 0==non c'�) > WriteLine1: > mov cx, 15 > mov di, si > .1: mov byte[di], '|' > test dx, 1 > jnz .2 > mov byte[di], ' ' > .2: jcxz .3 > mov word[di+1], " " > dec cx > shr dx, 1 > add di, 3 > jmp short .1 > .3: call outputLine > .z: > ret I wonder if WriteLine and WriteLine1 could be combined... self-modifying code, possibly? > seed dw 12921 > --------------------- > ; m2m m.m m.asm > ;com file > ;nasmw -o m.com m.asm > > org 100h > Start: > <b,i,j,k [snip] I'll take your word for it. :) Okay, now I'll go look at what the rules actually are... I probably won't make an entry... might not spend much time with it (dos is a "step backwards" for me). But I like short code, and I've learned a lot from just looking at previous Hugi Compos... and gotten some tips from Ben. Thanks for both, Ben! If you want to go to "secret" code to make an entry for the competition, I'll shut up. Otherwise, it might be fun to play with your code, "just for fun"... Best, Frank
From: Rod Pemberton on 22 Sep 2009 16:03 "Benjamin David Lunt" <zfysz(a)frontiernet.net> wrote in message news:h75um.229533$Qg6.95597(a)newsfe14.iad... > > I wonder how you could post it then. Source is easy, just post here... Does a submission really need a .com if made by tasm or nasm? A hex dump could be used to confirm. > Do you have a web > page? No. > There are many free upload sites, though they > may need an account too. Well, Rapidshare doesn't need an email account to upload files. It's anonymous to upload. I guess I could use that to upload a .zip, if a .com is really needed. Click on a link to download what I uploaded. But, I'd have to post the link here for you - which could allow others to look if that's a actually a concern... However, Rapidshare sometimes posts the link in the webpage, and other times it wants an email account to send your deletion link to. I usually just direct these to an free service intended for deleting spam email, or receiving confirmations: http://mytrashmail.com You just create an email name when you need it, addressed to one of their active domains. Anything sent to that name/domain will be waiting in the account for you to read/delete via http/html form, or automatically deleted if you (or no one else) ever accesses that named account. It's free, anonymous, but if you use a simple name someone else could read what is sent. But, it's supposed to be used for spam anyway... > If you wanted to, wait until the day after the deadline > for the competition, then post it here. I will include > it in the results. Ok. Rapidshare, or here are two options. Rod Pemberton
From: io_x on 23 Sep 2009 02:39 "Frank Kotler" <fbkotler(a)myfairpoint.net> ha scritto nel messaggio news:h9b6re$3rg$1(a)aioe.org... > io_x wrote: > > Hi... "io_x"(???), Rosario, that's you isn't it? What would you prefer to be > called? > >>> We have started a new competition at >>> http://www.frontiernet.net/~fys/hugi/hcompo.htm > > ... >> if i understand well >> this is my try (195 byte) > > Cool! But this isn't fair - to *you*! I can steal your code, trim a byte out > of it, and submit it as my own work! > > While I appreciate the importance of "competition", I also recognize the > importance of "cooperating to solve problems". So, "just for fun"... > > I haven't yet looked at the rules, the algorithm, the example programs, etc. I > suspect 195 bytes isn't even close - these guys are *good*! They go by names > like "Boiled Brain" and stuff... may not be an entirely good thing to be that > good! :) Anyway, just some untested thoughts on how this might be made > shorter... Io non ho letto le regole del gioco, percio' pensavo che solo un labirinto pseudo random fosse sufficiente; invece bisogna creare un labirinto (e si spiega che cosa e' un labirinto) seguendo particolari regole (e si spiegano tali regole) Perci� il codice postato prima � sbagliato. [I did not read the game laws, so i thought that a pseudo random maze would be enough; but this is wrong because there are laws for what is a maze (and they explain what are these laws) So the code posted by me is totally wrong. ] A quello che ho capito si tratta di suddividere un rettangolo del tipo [for what i can understand it is about divide this rectangle] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 0 S | + + 1| | + + 2| | + + 3| | + + 4| | + + 5| | + + 6| | + + 7| | + + 8| | + + 9| | + + a| U +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ dove S � l'entrata e U � l'uscita (stampati nel labirinto come S=02h ed U=07fh), in modo che ciascuna suddivisione +--+ ed | appaia, su 100 labirinti casuali, all'interno un numero casuale di volte [where S is the enter and U is the exit (print in the maze with char S=02h, U=07fh), in the way each break +--+ and | is seen inside that rectangle, in 100 random maze, a random numeber of times] in modo che ciascuna casella all'interno sia collegata a qualsiasi altra casella all'interno in modo unico (non capisco perch�: in modo unico) [in the way each cell is connected to each other cell from a sole corridor (don't know why "a sole")] I think that a way to solve all this is use this algo found in Wikipedia: ------------------------- Recursive backtracker The depth-first search algorithm of maze generation is frequently implemented using backtracking: 1. Mark the current cell as 'Visited' 2. If the current cell has any neighbours which have not been visited 1. Choose randomly one of the unvisited neighbours 2. add the current cell to the stack 3. remove the wall between the current cell and the chosen cell 4. Make the chosen cell the current cell 5. Recursively call this function 3. else 1. remove the last current cell from the stack 2. Backtrack to the previous execution of this function ------------------------------ all this algo seems forget the exit condition: the first cell has not neighbours which have not been visited. don't know if it is ok or if there are easier algo for that
From: Frank Kotler on 23 Sep 2009 10:29
io_x wrote: > "Frank Kotler" <fbkotler(a)myfairpoint.net> ha scritto nel messaggio > news:h9b6re$3rg$1(a)aioe.org... >> io_x wrote: >> >> Hi... "io_x"(???), Rosario, that's you isn't it? What would you prefer to be >> called? No? >>>> We have started a new competition at >>>> http://www.frontiernet.net/~fys/hugi/hcompo.htm >> ... >>> if i understand well >>> this is my try (195 byte) >> Cool! But this isn't fair - to *you*! I can steal your code, trim a byte out >> of it, and submit it as my own work! >> >> While I appreciate the importance of "competition", I also recognize the >> importance of "cooperating to solve problems". So, "just for fun"... >> >> I haven't yet looked at the rules, the algorithm, the example programs, etc. I >> suspect 195 bytes isn't even close - these guys are *good*! They go by names >> like "Boiled Brain" and stuff... may not be an entirely good thing to be that >> good! :) Anyway, just some untested thoughts on how this might be made >> shorter... > > Io non ho letto le regole del gioco, percio' pensavo che solo un labirinto > pseudo random fosse sufficiente; invece bisogna creare un labirinto > (e si spiega che cosa e' un labirinto) seguendo particolari regole > (e si spiegano tali regole) > Perci� il codice postato prima � sbagliato. > > [I did not read the game laws, so i thought that a pseudo random maze > would be enough; but this is wrong because there are laws for what is a maze > (and they explain what are these laws) > So the code posted by me is totally wrong. > ] > > A quello che ho capito si tratta di suddividere un rettangolo del tipo > [for what i can understand it is about divide this rectangle] > > 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 > +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ > 0 S | > + + > 1| | > + + > 2| | > + + > 3| | > + + > 4| | > + + > 5| | > + + > 6| | > + + > 7| | > + + > 8| | > + + > 9| | > + + > a| U > +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ > > dove S � l'entrata e U � l'uscita (stampati nel labirinto come S=02h ed U=07fh), > in modo che ciascuna suddivisione > +--+ ed | appaia, su 100 labirinti casuali, all'interno un numero casuale di > volte > > [where S is the enter and U is the exit (print in the maze with char S=02h, > U=07fh), in the way each break +--+ and | is seen inside that rectangle, > in 100 random maze, a random numeber of times] > > in modo che ciascuna casella all'interno sia collegata a qualsiasi altra casella > all'interno in modo unico (non capisco perch�: in modo unico) > [in the way each cell is connected to each other cell from a sole corridor > (don't know why "a sole")] > > I think that a way to solve all this is use this algo found in Wikipedia: > ------------------------- > Recursive backtracker > The depth-first search algorithm of maze generation is frequently implemented > using backtracking: > 1. Mark the current cell as 'Visited' > 2. If the current cell has any neighbours which have not been visited > 1. Choose randomly one of the unvisited neighbours > 2. add the current cell to the stack > 3. remove the wall between the current cell and the chosen cell > 4. Make the chosen cell the current cell > 5. Recursively call this function > 3. else > 1. remove the last current cell from the stack > 2. Backtrack to the previous execution of this function > ------------------------------ > all this algo seems forget the exit condition: the first cell has not > neighbours which have not been visited. > don't know if it is ok or if there are easier algo for that I read the Wikipedia entry and said "Huh???" - I'll have to read over that again. What I noticed in the "rules" was that we're supposed to use dos routines for printing, rather than bios routines, so the output can be redirected to a file for "test" purposes (I was thinking of trying "direct screen write", but that's "disqualified", too.) Also, we're supposed to accept the "seed" from the command line, defaulting to 0 if there isn't one... (Oh yeah, a "ghost" at the entrance and a "house" at the exit, too!) As an experiment, I tried your code (exactly as posted) with and without the "-Ox" switch. The "-Ox" switch cuts it down to 190 bytes, so that part of my advice was correct, anyway... I wish I could provide a translation to Italian for you (thanks for doing that!), but unfortunately English is all I know. Horrible, irregular, illogical language, but it's "popular". (Chinese will be the "default" language soon, I suspect) Good luck with a "correct" version! Best, Frank |