From: Espineter on
On Oct 11, 6:49 pm, "io_x" <a...(a)b.c.invalid> wrote:
> "io_x" <a...(a)b.c.invalid> ha scritto nel messaggionews:4aced9f9$0$1107$4fafbaef(a)reader1.news.tin.it...
>
>
>
> > "io_x" <a...(a)b.c.invalid> ha scritto nel messaggio
> >news:4acc66f1$0$1100$4fafbaef(a)reader3.news.tin.it...
>
> >> "io_x" <a...(a)b.c.invalid> ha scritto nel messaggio
> >>news:4ac5c7f6$0$1106$4fafbaef(a)reader4.news.tin.it...
> >>>http://www.frontiernet.net/~fys/hugi/hcompo.htm
>
> >> it is 200 byte
>
> > 188
>
> 179
> %define   L   25
> %define   H   10
>
> ; massimi valori
> ;%define   L    85
> ;%define   H    86
>
> %define   BytesMemory    ((L+1)*(H+2)*6)
> %define   H21            (2*H+1)
> %define   sopra          (L+1)*6
> %define   sopra2         (L+1)*3
>
>           org     100h
> Start:
>           mov     di,  arr
>           mov     ch,  (BytesMemory>>8)
>           rep     stosb         ; all 0  cx==0 [7]
> ;  ****************************
> ;  ***  Prende il numero with the help by Esra Sdrawkcab
> ;  ****************************
> ; assumo che   ax==0  bx=0
>           mov     si,  081h
>           mov     bl,  ' '
> .0:       aad     10            ; al+=10*ah e ah=0
>           mov     ah,  al
>           lodsb
>           sub     al,  bl
>           mov     bl,  '0'      ; prima ' ' poi '0'
>           jge     .0            ; o un char minore di '0'
>           mov     bl,  ah       ; inizializza il seed==bx per rand
> ;  *******************************************
> ;  *** Fa la griglia
> ;  *******************************************
>           mov     di,  (arr+sopra2)
>           mov     bp,  H21
>           mov     ax,  "+-"
>           mov     dx,  "|N"
>           push    di            ; conserva per la stampa
> .2:       mov     cl,  L        ; altrimenti visitate
> .3:       stosw
>           mov     byte[di],  ah
>           inc     di
>           loop    .3
>           stosb
>           mov     word[di],  0a0dh
>           inc     di
>           inc     di            ; fa la linea
>           xchg    ax,  dx
>           dec     bp
>           jnz     .2            ; passa alla linea successiva
>           mov     byte[di],  '$'
>           mov     byte[di-sopra2-3],  07fh
>           mov     di,  (arr+sopra)
>           mov     byte[di],  02h ; ritorna in si la casella iniziale
> ; **************************************
> ; *** Trova una casella casuale
> ; **************************************
> ;  P(x,y)=j_inz+y*(L+1)*6+x*3
>           mov     cl,  L
>           call    ran
>           imul    bp,  dx,  byte  3 ; x*3
>           mov     cl,  H
>           call    ran
>           imul    si,  dx,  sopra ; y*(L+1)*6
>           add     di,  si
>           add     di,  bp       ; in di la casella iniziale
> ;  *******************************************
> ;  *** Fa il labirinto
> ;  *******************************************
> ; parte dalla casella puntata da di
>           inc     di            ; punta nella casella, dove c'e' 'N'
> .4:       mov     word[di],  "  " ; "  " significa visitata
> .5:       mov     cl,  4
>           call    ran           ; le caselle confinanti sono 4
> .6:       mov     si,  3        ; dl=0[destra],1[basso], 2[sinistra],3[alto]
>           and     dx,  si
>           test    dl,  1
>           jz      .6a
>           mov     si,  sopra    ; 3        ,sopra   ,-3          ,-sopra
> .6a:      mov     bp,  si
>           shr     bp,  1        ; pb=offset muro, si=offset next
>           cmp     dl,  1
>           jbe     .6b
>           neg     bp
>           neg     si
> .6b:      add     si,  di
>           cmp     byte[si],  'N'
>           je      .a            ; se tale casella non e' visitata va in .a
> .7:       inc     dx
>           loop    .6            ; vai alla prossima casella
> ; ** caso le caselle sono tutte visitate
>           cmp     sp,  0FFFCh
>           jae     .z            ; se lo stack e' vuoto esci
>           pop     dx
>           pop     di            ; altrimenti prende la casella precedente
>           mov     cl,  4
>           jmp     short  .7
> %if BytesMemory>24000
> .e:       mov     sp,  0FFFEh
>           ret                   ; nel caso di errore non stampa proprio niente:
> ; ritorna al DOS
> %endif
> .a:       ; ** caso vi è una casella non visitata
>           mov     word[di+bp],  "  " ; leva il muro di divisione [ed forse una
> N]
> ; che verra' in ogni caso levata in .4
> %if BytesMemory>24000
>           cmp     sp,  limite
>           jbe     .e            ; lo stack non puo' invadere la memoria
> %endif
>           push    di
>           push    dx
>           mov     di,  si
>           jmp     short  .4
> .z:
> ;   ******************************
> ;   *** Stampa sullo schermo
> ;   ******************************
>           pop     dx
>           mov     ah,  09h
>           int     21h
>           ret
>
> ; ritorna un numero 0..cx in dx
> ran:
>           mov     ax,  04e35h
>           imul    bx
>           inc     ax
>           xchg    ax,  bx
>           movzx   ax,  bh
>           cwd
>           idiv    cx
>           ret
>
>           Section   .bss
> arr resb BytesMemory
> fine resb 128 ; stack riservato al MSDOS
> limite resb 4

Good job io_x. A basic optimization is that you can sum 2 to di with
one byte, by scasw (or cmpsw). I suggest you create a group and
discussing by email or in a private forum. You have a good structure
with many possibilies of saving bytes, so your code can reach 160
bytes.

Regards
Antonio Villena
From: Rod Pemberton on
"Espineter" <espineter(a)gmail.com> wrote in message
news:c98502bf-294d-44cb-b599-b9e926792be4(a)k33g2000yqa.googlegroups.com...
>
> It's a pity that you can't complete your entry. As I can see you are
> very close to finish.

I'm not so sure about that. The equivalent of a ConFrom routine as I'm
trying to implement it is huge. And, it will radically change the display
routine I need... more bloat. I'll have to come up with something
different. I just coded another display routine that works by a different
method. It's adds few bytes currently but isn't fully optimized. It may be
more suitable for use with the ConFrom routine. If I can ever get that
routine working and finished... I may have spent too much time working on
the display routines.

> > Current size 98+(unknown):
> > 40 bytes display routine
> > 10 bytes entry + exit character
> > 17 bytes random routine
> > 13 bytes parameter routine
> > 3 bytes move parameter to seed
> > 15 bytes to setup initial x and y
> > (unknown) ConFrom
> > (unknown) ChkCell
> >
> > Any takers? Comments from the judge?
>
> Good size. Excelent 13 bytes parameter routine, mine is 15.

Hmm, ok, let me recheck my count. Yes, 13 bytes parameter + 3 bytes move
result to "seed". Except for the move to seed, it's basically the same
routine as posted by io_x in the "first argument for a .com program" on
9/29. It's slightly different as mentioned in that thread. The 13 byte
version has one change that developed due to other code... Is your random
routine smaller or larger?


Rod Pemberton


From: Esra Sdrawkcab on
On Sun, 11 Oct 2009 23:05:10 +0100, Espineter <espineter(a)gmail.com> wrote:

>
>> Aw...
>>
>> I have two issues with that.
>>
>> The first was how I can submit my entry without having email access,
>> which
>> Ben and I discussed, but didn't completely resolve...
>>
>
> Hi Rod
> You can use a FTP server, web upload, etc... but I think the easy
> way is open a free account at gmail.com, yahoo.com or hotmail.com. Or
> use the email of a friend.
>
>> The second was that due to life and time constraints, I'm not sure if
>> I'm
>> going to complete my entry. So, I was considering posting the smallest
>> of
>> what I did do here so that perhaps io_x and Esra could team up and use
>> it to
>> come up with a slightly smaller entry. I'm not going to post the 30+
>> display routines I've attempted, even though one of them may optimize
>> better... I'm missing the central ConFrom and ChkCell routines. So,
>> it's
>> only likely they'll be able to shave a few bytes, if any. Even with my
>> code, I think it's very unlikely anyone will approach the size you
>> currently
>> have... And, of course, you could use to keep your lead, if
>> necessary...
>
> It's a pity that you can't complete your entry. As I can see you are
> very close to finish. Also you can participate as a group, in earlier
> compos there was a common way.
>
> But if you, io_x and company post all your code here it's a free
> help for the other participants. Perhaps doesn't affect to the top 4
> or 5 in the ranking, but I think It's a good entry and making
> optimizations can squeeze easily 10 or 20 bytes. The aim of this compo
> is mantain the code secret until ends.
>
>>
>> Current size 98+(unknown):
>> 40 bytes display routine
>> 10 bytes entry + exit character
>> 17 bytes random routine
>> 13 bytes parameter routine
>> 3 bytes move parameter to seed
>> 15 bytes to setup initial x and y
>> (unknown) ConFrom
>> (unknown) ChkCell
>>
>> Any takers? Comments from the judge?
>
> Good size. Excelent 13 bytes parameter routine, mine is 15.
>

io_x's (179) entry is

18 getseed
45 set full maze
+7 clear display area
21 set initial posn
68 DFE
6 print & exit
14 RNG





--
Nuns! Reverse!
From: Espineter on
On Oct 12, 1:24 am, "Rod Pemberton" <do_not_h...(a)nohavenot.cmm> wrote:
> Is your random routine smaller or larger?

http://hcompo.temet.es/forum/viewtopic.php?f=5&t=19&start=0#p94
From: Esra Sdrawkcab on
On Sun, 11 Oct 2009 23:11:34 +0100, Espineter <espineter(a)gmail.com> wrote:

> On Oct 11, 12:10 pm, "Esra Sdrawkcab" <ad...(a)127.0.0.1> wrote:
>> On Sun, 11 Oct 2009 02:20:07 +0100, Espineter <espine...(a)gmail.com>
>> wrote:
>> > Hi
>> > Please don't reveal internal secrets of your entry. People can read
>> > this public group and:
>> > -They can rewrite this code, and position before you only with a byte
>> > improvement of this code.
>> > -Also is possible extract ideas that can be applied in his entries
>>
>> io_x has published all (AFAIK) his code here, I've chipped in a few not
>> very ground-breaking suggestions. He's still a long way from 150 bytes
>> let alone 130 odd.
>
> Yes. I know it's an "amateur" entry. It's only a suggestion.
> Probably it's difficult that the rest of the participants read this
> group. I have found googling "hugi compo 29". So I think with some
> easy improvements can be under 160 bytes.
>

I've thought of a different way of represnting the grid - but my code is
now
260 bytes. Oops.
>
>>
>> --
>> Nuns! Reverse!
>


--
Nuns! Reverse!