flat assembler
Message board for the users of flat assembler.

Index > Heap > Esoteric Programming Challenges!

Goto page Previous  1, 2, 3, 4, 5, 6 ... 10, 11, 12  Next
Author
Thread Post new topic Reply to topic
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
Tomasz Grysztar wrote:
Well, this sounds just a like a three-dimensional variant, doesn't it? Wink
I guess it does.

Pirata Derek wrote:
BRAINFUCK: Its name tells you what it does...
Especially when you try to write something big in it.
Post 31 Aug 2009, 15:08
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
This optimization popped into my head when I woke up this morning:

35 bytes
Code:
"a4A4"v_@#:,>#+5<
1,:\-2<_$$#:^#:\+
    
Post 31 Aug 2009, 15:08
View user's profile Send private message Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
Sorry windwakr, that doesn't pause at the end, so is not valid.
Edit: I just realised your first one didn't either. Looks like I'm still the leader then Smile


Last edited by Pinecone_ on 31 Aug 2009, 15:12; edited 1 time in total
Post 31 Aug 2009, 15:10
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
Then my other one isn't valid either. You should test this stuff more.

_________________
----> * <---- My star, won HERE
Post 31 Aug 2009, 15:11
View user's profile Send private message Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
Sorry. I will be sure to test more in the future.
Post 31 Aug 2009, 15:13
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
Challenge 2

Befunge, 87 bytes:
Code:
<v-*84>#:# _@#:"abcdefgh*z@@@@@@i*y@@@@@@j*x@@@@@@k*w@@@@@@l*v@@@@@@m*utsrqpon"
 >,  :^
    


Horribly coded brainfuck, 121 bytes:
Code:
+++++++++++[>+>++++++>+++>++++++++<<<<-]>->->->++<<<<++++++++[>>.+<<-]>.<+++++[>>>>.-<......<.+<.<-]++++++++[>>>>.-<<<<-]
    


Wow, our code has a lot of similarities on the brainfuck one. I didn't even look at yours until I was done coding mine.

_________________
----> * <---- My star, won HERE
Post 31 Aug 2009, 17:39
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7714
Location: Kraków, Poland
Tomasz Grysztar
Challenge 2 in Pure Challenger:
Code:
)7:("A\  v
>1+.\"Z-v>
|<v-U"   <
1|< >"N- |
)   |-H"_ x
^<  <    <    


It's really hard for me to stop playing with this child. :D
Post 31 Aug 2009, 18:41
View user's profile Send private message Visit poster's website Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
Pinecone_, here's a 2 byte optimization of yours for the first challenge.
Although, since its just a rearrangement of yours, I think you should take the credit for it.
Code:
"A4"v >"@~a"10p70p91+,
:\-2<_^#:\+1,
    

_________________
----> * <---- My star, won HERE
Post 31 Aug 2009, 18:54
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
Tomasz Grysztar wrote:

It's really hard for me to stop playing with this child. Very Happy


Like a kid in a candy store. Laughing

Thanks again to Pinecone_ for starting this thread! Smile

EDIT: You know who would maybe get a kick out of this thread? That Rick Hohensee guy. He wrote an x86 assembler (Forth-ish) in Bash. He also messed around with what he calls x86's "Forreal" mode (download: Forreal.tgz). Actually, he dropped briefly by comp.os.msdos.djgpp, and I pointed him here, but I guess he's too busy "running for president", heh.
Post 31 Aug 2009, 19:04
View user's profile Send private message Visit poster's website Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
83 bytes on challenge 2 Befunge now:
Code:
<>:#,_v#:"ABCDEFGH"05"ZIYJXKWLVMUTSRQPON"
\_v#:$<,+55\-1\,,,,,,::::::*84,
#:<>:#,_@
    

_________________
----> * <---- My star, won HERE
Post 31 Aug 2009, 20:13
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7714
Location: Kraków, Poland
Tomasz Grysztar
rugxulo wrote:
EDIT: You know who would maybe get a kick out of this thread? That Rick Hohensee guy. He wrote an x86 assembler (Forth-ish) in Bash. He also messed around with what he calls x86's "Forreal" mode (download: Forreal.tgz).

Hmm, it seems like he implemented the same thing that I called the unREAL mode in my implementation (fasm for DOS and the kelvar example use this mode). This was really a lot of fun implementing it - I did it with help of Leonid Petroff, he was a great comrade in DOS programming. Before I realized that it is possible to relocate IDT for 32-bit code, we had to use a hybrid interrupt handlers, which were able to detect, whether they are executed as 16-bit or 32-bit mode, and behave accordingly. I'm afraid I don't have the copy of those first implementation, but from my memory the beginning of interrupt vector looked like:
Code:
use16
mov cr3,eax ; bitness-independent instruction; CR3 used as a safe storage, as it's unused in real mode
mov ax,0
jmp short int_16bit ; in 32-bit the "mov eax" instruction eats this two-byte jump
use32
; here we know we're in 32-bit code, so we have to switch back to 16-bit before calling DOS/BIOS interrupt handler
; ...
int_16bit:
; here just restore EAX from CR3 and jump to the original interrupt handler    
Of course with separate interrupt tables for 16-bit and 32-bit mode this became much simpler and such implementation you can see in fasm.

Sorry for the offtopic.
Post 31 Aug 2009, 21:22
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
Tomasz Grysztar wrote:

Sorry for the offtopic.


My bad for mentioning it here, but I kept meaning to bounce it off you yet kept forgetting. Anyways, I'll start a new thread in OS Construction. Wink
Post 01 Sep 2009, 03:10
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
windwakr wrote:
Challenge 2

Befunge, 87 bytes:
Code:
<v-*84>#:# _@#:"abcdefgh*z@@@@@@i*y@@@@@@j*x@@@@@@k*w@@@@@@l*v@@@@@@m*utsrqpon"
 >,  :^    
Accepted.



windwakr wrote:
Horribly coded brainfuck, 121 bytes:
Code:
+++++++++++[>+>++++++>+++>++++++++<<<<-]>->->->++<<<<++++++++[>>.+<<-]>.<+++++[>>>>.-<......<.+<.<-]++++++++[>>>>.-<<<<-]    
Accepted.



Tomasz Grysztar wrote:
Challenge 2 in Pure Challenger:
Code:
)7:("A\  v
>1+.\"Z-v>
|<v-U"   <
1|< >"N- |
)   |-H"_ x
^<  <    <    
Accepted. 66 bytes.



windwakr wrote:
Pinecone_, here's a 2 byte optimization of yours for the first challenge.
Although, since its just a rearrangement of yours, I think you should take the credit for it.
Code:
"A4"v >"@~a"10p70p91+,
:\-2<_^#:\+1,    
I already posted that somewhere in this thread. It doesn't print a new line at the end, therefore isn't valid.



rugxulo wrote:
Thanks again to Pinecone_ for starting this thread!
No problem! It's great that this is receiving so much attention, i didn't expect quite this much.



windwakr wrote:
83 bytes on challenge 2 Befunge now:
Code:
<>:#,_v#:"ABCDEFGH"05"ZIYJXKWLVMUTSRQPON"
\_v#:$<,+55\-1\,,,,,,::::::*84,
#:<>:#,_@    
Rejected. I get this output:
Code:
ABCDEFGHZ
I
Y
J
X    
Post 01 Sep 2009, 06:29
View user's profile Send private message Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
Challenge 2, 107 bytes in brainfuck:
Code:
++++++++++[>+>++++++>+++>+++++++++>+<<<<<-]>-->+++++<[>.+<-]+++++>>++<<[>>>>.<.-<......<.+<-]>>>>.--[<.->-]    


revolution,
Your challenges say "Between 1 and 13". Does that include 1 and 13?


Last edited by Pinecone_ on 01 Sep 2009, 11:25; edited 2 times in total
Post 01 Sep 2009, 11:01
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17248
Location: In your JS exploiting you and your system
revolution
Pinecone_ wrote:
revolution,
Your challenges say "Between 1 and 13". Does that include 1 and 13?
Yes.
revolution wrote:
I also would like to issue a small Befunge programming challenge.

Generate random numbers between 1 and 13 inclusive, the distribution must be uniform.
Post 01 Sep 2009, 11:20
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
Right. Sorry, i missed that word Razz

Here's my first try for Challenge 3. 81 bytes. Since you thought of the competition, you approve or reject submissions for it.
Code:
v>>>>>>>>.@
> v2
>^1?3^+++
54$^  123
  >v
   #

^?<?9#^?^
 6 v   4
 v7?v  +
   89    


Edit: 77 bytes. and looks much nicer Smile
Code:
v>>>>>>>>>>>>>.~@
"++++123456789
^1234^?^^?^^?^
"
<^?^#<^  ?  ^#p39
  ^  ^9  <    
Post 01 Sep 2009, 11:25
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17248
Location: In your JS exploiting you and your system
revolution
Pinecone_ wrote:
Here's my first try for Challenge 3. 81 bytes. Since you thought of the competition, you approve or reject submissions for it.
Code:
v>>>>>>>>.@
> v2
>^1?3^+++
54$^  123
  >v
   #

^?<?9#^?^
 6 v   4
 v7?v  +
   89    
Reject. The distribution must be uniform.

You have this distribution:
  1. 1/12
  2. 1/12
  3. 1/12
  4. 1/12
  5. 1/12
  6. 1/12
  7. 1/12
  8. 1/12
  9. 1/12
  10. 1/16
  11. 1/16
  12. 1/16
  13. 1/16
Post 01 Sep 2009, 12:02
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17248
Location: In your JS exploiting you and your system
revolution
Pinecone_ wrote:
Edit: 77 bytes. and looks much nicer Smile
Code:
v>>>>>>>>>>>>>.~@
"++++123456789
^1234^?^^?^^?^
"
<^?^#<^  ?  ^#p39
  ^  ^9  <    
Are you sure that can generate ALL numbers from 1-13? Hint: 13 cannot be generated
Post 01 Sep 2009, 12:08
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
Aha not generating 13 was just a mistake. But i see your point about the distribution. I have no clue Razz maybe someone else can build off this...
Code:
v>>>>>>>>>>>>>.~@
"++++123456789
^1234^?^^?^^?^
"
<^?^#<^  ?  ^#p39
  > ^^9  <    
Post 01 Sep 2009, 12:14
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
Pinecone_ wrote:
windwakr wrote:
83 bytes on challenge 2 Befunge now:
Code:
<>:#,_v#:"ABCDEFGH"05"ZIYJXKWLVMUTSRQPON"
\_v#:$<,+55\-1\,,,,,,::::::*84,
#:<>:#,_@    
Rejected. I get this output:
Code:
ABCDEFGHZ
I
Y
J
X    


I had it working at one time. I guess I made too many changes to it before posting it, and I didn't test them.....stupid me for not backing up my work....Gimme a sec, I'll get it working..

DAMMIT, I couldn't figure out how I had it working before....so here's an 86 byte one....I guess it's better than my 87...

Code:
<>:#,_  v#:"ABCDEFGH"05"ZIYJXKWLVMUTSRQPON"
v#:$,+55<:-1,\,,,,,,:::::*84,\_
<>:#,_@#:$
    


Here's a stack optimization for your brainfuck, it shaves off 4 bytes
Code:
++++++++++[>++++++>+>+++>+++++++++>+<<<<<-]>+++++>--[<.+>-]+++++>++<[>>>.<.-<......<<.+>-]>>>.--[<.->-]
    

_________________
----> * <---- My star, won HERE
Post 01 Sep 2009, 16:52
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3, 4, 5, 6 ... 10, 11, 12  Next

< 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 can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.