From: io_x on

"Esra Sdrawkcab" <admin(a)127.0.0.1> ha scritto nel messaggio
news:op.u1kxt8ckhswpfo(a)dell3100...
> On Fri, 09 Oct 2009 07:43:32 +0100, io_x <a(a)b.c.invalid> wrote:
>
>>
>> "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
>
> [snipped]
>
>
>> ; *******************************************
>> ; *** Fa la griglia
>> ; *******************************************
>
> Could you save some here by not filling the maze at start, but adding crlf as
> you go?

arr
x----------------------------+
x-------------------------+ |
arr+sopra | |
| |
| |
--------------------------+ |
-----------------------------+

what you say is right if and ony if
in the border of that rectangle
there is no 'N' char [that mean "not visit"]

If it is certain that in a .bss section
memory there is no 'N' all is ok

for example "debug" show that all memory in .bss
section are only \0s

> (add 3 bytes)
> mov si,0A0dh
>
> (delete these 4 lines, 10 bytes)
>
>> mov di, arr
>> mov cx, BytesMemory
>> mov al, 10
>> rep stosb ; all\a cx==0
>
>
>> mov di, (arr+sopra2)
>> mov bp, H21
>> mov ax, "+-"
>> mov dx, "|N"
>> .2: mov cl, L ; altrimenti visitate
>> .3: stosw
>> mov byte[di], ah
>> inc di
>> loop .3
>> stosb
>
>
> (delete these 3 lines 4 bytes)
>> mov byte[di], 13
>> inc di
>> inc di ; fa la linea
>
> but adding crlf here?
> (add 3 lines 3 bytes)
> xchg ax,si ; si not used yet, make it crlf
> stosw ; add crlf, 2*inc di
> xchg ax,si ;put back

3+3=6
this should be 6 too:
mov word [di], 0a0dh ; +4
inc di ; +1
inc di ; +1

>> xchg ax, dx
>> dec bp
>> jnz .2 ; passa alla linea successiva
>> mov byte[di], '$'
>> mov byte[di-sopra2-3], 07fh
>> mov si, (arr+sopra)
>> mov byte[si], 02h ; ritorna in si la casella iniziale
>
> initialise maze is now 2C bytes =44d
>
>
>
> Nuns! Reverse!





From: io_x on

"io_x" <a(a)b.c.invalid> ha scritto nel messaggio
news: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


From: Esra Sdrawkcab on
On Thu, 08 Oct 2009 01:17:06 +0100, Benjamin David Lunt
<zfysz(a)frontiernet.net> wrote:

>
> "io_x" <a(a)b.c.invalid> wrote in message
> 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
>>
>
> Got it. It passes the test. Thanks.
> Ben
>
>
I haven't seen io_x post recently, so I'd like to submit a slight
improvement (174 bytes) on his behalf
(from the headers and his comments, I'm fairly sure he's from Italy)
is your email address the correct one to send entries to?


--
Nuns! Reverse!
From: Benjamin David Lunt on

"Esra Sdrawkcab" <admin(a)127.0.0.1> wrote in message
news:op.u2h8zln7hswpfo(a)dell3100...
> On Thu, 08 Oct 2009 01:17:06 +0100, Benjamin David Lunt
> <zfysz(a)frontiernet.net> wrote:
>
>>
>> "io_x" <a(a)b.c.invalid> wrote in message
>> 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
>>>
>>
>> Got it. It passes the test. Thanks.
>> Ben
>>
>>
> I haven't seen io_x post recently, so I'd like to submit a slight
> improvement (174 bytes) on his behalf
> (from the headers and his comments, I'm fairly sure he's from Italy)
> is your email address the correct one to send entries to?

Remove the zzzz's and it will be correct.

Thanks,
Ben


From: Esra Sdrawkcab on
On Wed, 28 Oct 2009 14:14:24 -0000, Benjamin David Lunt
<zfysz(a)frontiernet.net> wrote:

>
> "Esra Sdrawkcab" <admin(a)127.0.0.1> wrote in message
> news:op.u2h8zln7hswpfo(a)dell3100...
>> On Thu, 08 Oct 2009 01:17:06 +0100, Benjamin David Lunt
>> <zfysz(a)frontiernet.net> wrote:
[]
>> I haven't seen io_x post recently, so I'd like to submit a slight
>> improvement (174 bytes) on his behalf

I've trimmed it down a bit more, by risking that the unallocated space
doesn't have any 'N's in critical spots, and a couple of tweaks.

I've submitted it to Ben.






--
Nuns! Reverse!