flat assembler
Message board for the users of flat assembler.

Index > Windows > Smallest sudoku solver

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
TmX



Joined: 02 Mar 2006
Posts: 843
Location: Jakarta, Indonesia
TmX 19 Jun 2007, 09:33
ssp wrote:

Yeah! That's very nasty!
This code does not belong here. You should have translated it into fasm first and then posted it here.
What's the purpose of it? Tell me you stupid, blockhead, dumb creature!

I can't understand it, or compile it with fasm/nasm/masm/gas/goasm and to top it all it's horrible to look at!

Go learn some ettiquettes before posting here.


That code must be compiled using Octasm (which is written in FASM anyway)
Wink
Post 19 Jun 2007, 09:33
View user's profile Send private message Reply with quote
ssp



Joined: 05 Mar 2007
Posts: 38
Location: India
ssp 19 Jun 2007, 10:10
Nonetheless, the guy should have converted it into fasm syntax.
And I am very particular about it. This is fasm forum.
Post 19 Jun 2007, 10:10
View user's profile Send private message Yahoo Messenger Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 19 Jun 2007, 14:28
ssp wrote:

Go learn some ettiquettes before posting here.

I think you're the one who needs to learn some etiquette. rugxulo's code isn't pretty, but it isn't meant to be - it's short.
Post 19 Jun 2007, 14:28
View user's profile Send private message Visit poster's website Reply with quote
ssp



Joined: 05 Mar 2007
Posts: 38
Location: India
ssp 19 Jun 2007, 16:26
Thanks f0dder for spelling correction.

Well since I was not talking to you, you were not supposed to get
offended and you must not have replied.

Now that you have entered in a matter which was between me
and rugxulo face the consequences.

To me f0dder has a Zero, because you have

Zero sense of posting to such forums
Zero sense of dealing with others
Zero thoughts of mind
and to top it all Zero brains.

So get lost you stupid-wag-in-other's-matters ! ! !
Post 19 Jun 2007, 16:26
View user's profile Send private message Yahoo Messenger Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 19 Jun 2007, 18:43
Don't be so up tight, here. This place is made up of a bunch of coders who really don't care about much. If you don't like a place that has a really loose way of doing things then not come here, because that's the way it is.
Post 19 Jun 2007, 18:43
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
ssp



Joined: 05 Mar 2007
Posts: 38
Location: India
ssp 20 Jun 2007, 02:09
Hello Kohlrak, it's not all so very messy!
The forum has some great stuff to boast of.
Besides fasm is simply great!
But a few creatures of hell just wanna have the same atmosphere
here.

And I will not let this happen.
Post 20 Jun 2007, 02:09
View user's profile Send private message Yahoo Messenger Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 20 Jun 2007, 02:39
We are all here for the benefit of fasm. Posting code of other sources here won't hurt fasm. Only those who won't change their opinion of fasm easily will change their mind. You're concerning people here. Just like you, i too was all up in arms (really concerned) about rule enforcement when i joined. As time went by i realized that being so concerned alone was breaking an unspoken rule. The moderators here see it as more important for the people here not to be so harsh than to follow the rules. Some people have taken offence to what you have said. Most of those people have been here for a long time and have gotten to know the administration well enough to know what rules you can break just a little. While this is a fasm board, we are allowed to post code from other assemblers, though all high level code should be posted in the high level area. And aside from insults and some inappropriate material, everything is allowed in the heap. It's something you have to spend lots of time here to get to know. It's like that on many other boards as well. I know you've been here for a few months, but that's hardly enough time to get to know the place well enough. I know you're concerned for the well being of this place, but some people think that your method of expressing your concern is going to have the opposite effect.
Post 20 Jun 2007, 02:39
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
ssp



Joined: 05 Mar 2007
Posts: 38
Location: India
ssp 20 Jun 2007, 04:00
Thanks Kohlrak!

I think I understood what you said.
And now I think I will mind my own business and let the moderators
get their hands dirty while dealing with such things.
Post 20 Jun 2007, 04:00
View user's profile Send private message Yahoo Messenger Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 20 Jun 2007, 04:01
Thank you.
Post 20 Jun 2007, 04:01
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
ssp



Joined: 05 Mar 2007
Posts: 38
Location: India
ssp 20 Jun 2007, 05:23
Smile
Post 20 Jun 2007, 05:23
View user's profile Send private message Yahoo Messenger Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 24 Jun 2007, 23:26
I didn't write that Sudoku Solver, it was from (after) a Hugi compo, developed by three guys. The point in listing the four "translations" here was that they were small (like, for an e-mail sig, or whatever). Also, AFAIK, this (sub)forum still doesn't let non-registered people download files.

P.S. Octasm assembles itself, but I believe (?) it was originally written with A86. (It's OctaOS that runs FASM.) Not many assemblers let you write multiple instructions on one line. The brevity was the whole idea.
Post 24 Jun 2007, 23:26
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1905
DOS386 25 Jun 2007, 00:00
> this (sub)forum still doesn't let non-registered people download files

http://board.flatassembler.net/topic.php?t=7222 Sad
Post 25 Jun 2007, 00:00
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 25 Jun 2007, 01:53
NTOSKRNL_VXE, yes, I saw that. I do kinda think letting people download without registering wouldn't be a bad thing.

BTW, Octavio doesn't have his own forum, but he's plenty smart and has written some very cool stuff, so a little "propaganda" here and there for him by me ain't so horrible, IMO. Wink
Post 25 Jun 2007, 01:53
View user's profile Send private message Visit poster's website Reply with quote
m



Joined: 28 Dec 2006
Posts: 304
Location: in
m 01 Jul 2007, 08:59
rugxulo wrote:
62-byte Sudoku solver (using Octasm) (six lines, good for a sig):

Code:
LANG OCTASM,0.1 org 100h use16 file_out \sudoku.com ah=3Fh dx=bp # int 21h
xchg ax,cx inc bx # [bp+si]=al # dec si js <3 ax=4031h # cmp b[bp+si],'.'
jne <2 di=cx # dec di pusha js <4 cmp [bp+di],al jne >2 xchg ax,di # aam 19
imul ax,11 xchg ax,si inc bx jpo <1 xor ax,si test ax,0E0C0h jle >2 # mul ah
# popa jo <4 b[bp+si]='.' cmp al,39h je <1 jmp <5-1 ; solver: `sudoku.com < 1.puz'
; G3=tgm80@@mail,ru  TFx=tfx@@bitmaster,it  Digimind=digimind@@aha,ru
    


can you please convert that to fasm Sad
Thanks alot if you do Smile

_________________
Attitude!
Post 01 Jul 2007, 08:59
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 02 Jul 2007, 00:07
Very simple modifications:

Code:
Comparing files entry.old and entry.ASM
***** entry.old

        model tiny
        codeseg
        startupcode
        .486

***** entry.ASM

;        model tiny
;        codeseg
;        startupcode
;        .486
ptr equ
org 100h

*****

***** entry.old
        jmp     ChkDgt-1
        end
***** entry.ASM
        jmp     ChkDgt-1
;        end
*****
    


Description: 62-byte Sudoku solver (.COM) w/ FASM src, plus example puzzles made with a puzzle generator (AIDAN.EXE) from IOCCC '05 w/ its full srcs, docs, etc.
Download
Filename: 62byte_sudoku_solver.zip
Filesize: 31.41 KB
Downloaded: 554 Time(s)

Post 02 Jul 2007, 00:07
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 09 Nov 2010, 07:41
vid wrote:
here is my quick try to beat you. It's 360 bytes of pure oldschool 16bit DOS code. Wink


Wow, a lot has changed since 2006! Wink

Quote:

it shows ALL possible solutions (yours seem to get stuck in endless loop if there is more than 1 solution)


Cool, that's even better!

Quote:

btw, code is still not after some heavy optimizations.

sources may be released after it is optimized. anyway, 360 bytes isn't that much to reverse Twisted Evil


FOUR YEARS LATER ... well I guess somebody had to finally reverse it. Razz Okay, so it's not perfectly obvious since I don't have "real" labels (just use bogus ones, heh, whatever came to mind), BUT ... the assembled binary does match 100% the old one. Sure, I could tweak it in various ways, but it's probably already small and fast enough. Mostly I just wanted to match 100% output to prove it works as intended.

vid, feel free to refresh (y)our memory! Laughing

Code:
; ss.com - DOS sudoku solver (for multiple solution puzzles)
; author: vid / M. Mocko
; assembler: FASM
; license: ??? (but permission to disassemble, so I did)
; URL: http://board.flatassembler.net/topic.php?t=6076

org 100h
  
Komenco:
  mov di,space
  mov cx,2d00h ; 11520
  mov al,0
  rep stosb

  xor bx,bx
  jmp Boop

Booga:
  int 21h
  cmp al,13
  jnz Eraro
  int 21h
  cmp al,10
  jnz Eraro

Boop:
  mov bl,0
  jmp Getkey

Blerp:
  int 21h
  cmp al,' '
  jnz Eraro

Getkey:
  mov ah,8
  int 21h

  cmp al,'1'
  jc Eraro
  cmp al,'9'
  jna Donkey
  cmp al,'x'
  jnz Eraro
  sub al,'H'
  inc byte [last]

Donkey:
  sub al,'0'
  mov [bx+space],al
  inc bl
  cmp bl,9
  jc Blerp
  inc bh
  cmp bh,bl
  jc Booga
  call Stooges
  add word [Droop+2],900h
  or byte [DroopJump],1
  mov word [DroopNop],09b3h ; "nop,nop" -> "mov bl,9" (self-modify)
  mov byte [MagicOne+1],0
  mov byte [MagicTwo+1],0
  call Yup
  ret

Eraro:
  mov ah,9
  mov dx,msg
  int 21h
  ret

msg db 'Bad input!$'

Yup:
  cmp byte [last],0
  ja Stooges
  call Boring
  ret

Stooges:
  mov si,9
Moe:
  mov cx,3
Larry:
  mov dx,3
Curly:
  mov bh,dl
  add bh,[si+smelly-1]
  mov bl,cl
  add bl,[si+dollar]

Droop:
  mov al,[bx+last-100h]
  mov [bx+last+800h],al
  cmp al,0
DroopJump:
  jz Moo
  xchg ax,bx
DroopNop:
  nop
  nop

Ook:
  push ax
  mov bh,al
  mov di,bx
  mov al,0
  or ax,si
  xchg bh,al
  mov al,bl
  mov bp,ax
  pop ax
MagicOne:
  jmp Plop

  cmp byte [bx+last+2300h],0
  jnz Frog
  cmp byte [di+last+1100h],0
  jnz Frog
  cmp byte [bp+last+1A00h],0
  jnz Frog

Plop:
  mov byte [bx+last+2300h],1
  mov byte [bp+last+1A00h],1
  mov byte [di+last+1100h],1
MagicTwo:
  jmp Moo
  xchg ax,bx
  mov [bx+last+800h],al
  dec byte [last]
  pusha
  call Yup
  popa
  inc byte [last]
  mov byte [bx+last+800h],0
  xchg ax,bx
  mov byte [bx+last+2300h],0
  mov byte [bp+last+1A00h],0
  mov byte [di+last+1100h],0
Frog:
  dec bl
  jnz Ook
  ret

Moo:
  dec dx
  jnz word Curly
  dec cx
  jnz word Larry
  dec si
  jnz word Moe
  ret

Boring:
  pusha
  xor bx,bx
Quux:
  mov bl,0
  jmp Grok
Borg:
  mov dl,' '
  int 21h

Grok:
  mov dl,[bx+space+900h]
  add dl,'0'
  mov ah,2
  int 21h
  inc bx
  cmp bl,9
  jc Borg
  mov dx,crlf
  mov ah,bl
  int 21h
  inc bh
  cmp bh,bl
  jc Quux
  int 21h
  popa
Fino:
  ret

crlf   db 13,10
dollar db '$'
doydoy db 0,3,6
       db 0,3,6
       db 0,3,6
smelly db 0,0,0
       db 3,3,3
       db 6,6,6
last   db 0

space:

; EOF
    
Post 09 Nov 2010, 07:41
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.