flat assembler
Message board for the users of flat assembler.

Index > Heap > Esoteric Programming Challenges!

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



Joined: 28 Apr 2008
Posts: 180
Pinecone_
rugxulo wrote:
Okay, don't hate me, but I finally tried your program. Wink I'm not anti-Windows (I'm using it now), but I honestly prefer DOS apps. Still, at least your app is console, so it's okay (although no help screen? without filename it just silently exits).

I dont hate you, everyone has their preferences Razz I dual boot ubuntu and windows, much prefer ubuntu, just haven't gotten into programming in it much yet and didnt know enough to do this (i know, its sad... Razz) anyway, glad you finally tried it Smile and thanks for the idea of a help screen! Razz

rugxulo wrote:
I don't know off the top of my head (although you did include a chess.bef in your scripts/ subdir, but it apparently doesn't work either). It doesn't seem to be accepting input, which should be algebraic notation, e.g. "a2a4" (enter). Apparently works with my DJGPP compile of bef.c, though.

Yeah i included that chess.bef script so that everyone that downloads this will see it doesnt work and might have some idea why... if anyone knows why, please post it so i can fix whatever is causing it Smile

rugxulo wrote:
I'm still learning the ins and outs, so I haven't written anything hugely brilliant (chess? heh ... gotta love that guy). Wink In particular, I just figured out that "#" apparently won't work the way I expected (e.g. won't skip the first cell on line wraparound), which is a little disappointing but not a huge deal.

If you put it on the 80th character on the line, it should skip the first character. However, i wouldn't rely on all befunge interpreters doing this right, simply because i think it would be uncommon and some implementations would not handle it correctly.


rugxulo wrote:
Anyways, ideas? (I know these aren't all realistic for us, especially me!!!, but if you want interesting goals ....)
  • uudecode
  • Befunge to asm convertor (written in Befunge)
  • sudoku solver


A sudoku solver might be interesting... although i dont think i'd be able to write one at all Razz i might try it later.

windwakr wrote:
79 bytes
Still looks quite unoptimized to me.
Code:
++++++++[>++++++++<-]>+>++[>+++++[>+++++>++<<-]>+[<<<.+>>>-]>.[-]<<<<++++++>-],     

76 bytes! Smile
Code:
++++++++++>++++++[>++++++++++<-]++[>+++++>+>+++++[<+++++>-]<[<.+>-]<+<<.>-],    


rugxulo wrote:
BTW, just so I don't keep adding more posts just for my silly comments, see the chess guy's Happy New Year program. The visualization is hilarious! Wink

That is just insane. Razz
Post 29 Aug 2009, 06:47
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
75 Laughing

I bet someone could make one in under 70, This looks unoptimized.
Code:
++++++++++[>+>++++++<<-]>>>++[<+++++>>+>+++++[<+++++>-]<[<<.+>>-]<<<.>+>-],
    


Some ideas "borrowed" from yours.
The whole loop part is almost completely borrowed from you.


UPDATE:
I had a 74 byte one, but lost it.....so here's the next one down....
73 Laughing
I optimized the stack placement a little.
++++++++++[>>+>++++++<<<-]>++[>>+++++>+>+++++[<+++++>-]<[<.+>-]<<.>+<<-],

UPDATE 2:
72...getting closer to 70...
+++++[>++>++++++++++++<<-]++[>>+++++>+>+++++[<+++++>-]<[<.+>-]<<.>+<<-],


UPDATE 3:
>.> I knew that beginning part looked pretty bad...HERE IS 70 BYTES
++++++++++[>+>++++++<<-]++[>>+++++>+>+++++[<+++++>-]<[<.+>-]<<.>+<<-],


UPDATE 4:
Laughing 68 Laughing
Code:
++++++++++[>+>++++++<<-]++[>>+++++>+>+++++[<+++++>-]<[<.+>-]<+<.<-],
    

Stack is something like (loopcounter),(newline),(alphabet),(alphabetcounter),(scratch for alphabetcounter)
I'm sure there is probably better placement for some of the stack values.

_________________
----> * <---- My star, won HERE


Last edited by windwakr on 29 Aug 2009, 22:30; edited 1 time in total
Post 29 Aug 2009, 18:11
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
I found a Sudoku solver, but it's in Befunge98 only. :-/

Also found some other cool things:

Befunge-mode.el for GNU Emacs (syntax highlighting, output viewing, etc.) -- N.B. It's from 2002, so I had to comment out all "hscroll" parts just to get it to work in 23.1. (Needs "calc" and "cl" also. But it works in DJGPP compile!)

ZBefunge, Befunge IDE written in Inform (interactive fiction), e.g. via Frotz. No syntax highlighting but does everything else (single step, view stack, view output). DJGPP Frotz works! Smile

P.S. I had another idea earlier but forgot to mention it: Blackjack. Even found one in Wasabi (Java Befunge IDE) although it didn't really seem too impressive (only "hit" available?? Lame....) Note that I'm not volunteering (I suck), but still !! Wink
Post 29 Aug 2009, 22:30
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
Here's the best Befunge debugger I could find that's not written in some sissy language. Just create the files "input.txt", "output.txt", and "stack.txt" in its directory. The run it like "befdeb32 (befunge_file) input.txt output.txt stack.txt" and type "?" to get a list of commands.


BTW:....
66 BYTES
Laughing Hmm, I see NO more optimizations....would need to completely rewrite to get smaller, if possible.
Code:
++++++++++[>+>++++++<<-]++[>>>>+++++[<<+>+++++>-]<+[<.+>-]<+<.<-],
    

_________________
----> * <---- My star, won HERE


Last edited by windwakr on 30 Aug 2009, 02:06; edited 1 time in total
Post 29 Aug 2009, 23:49
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
Okay, I can't really write anything hugely fascinating, but this is as tricky / interesting as I can get (for now):

Code:
v (written by Armslurp)   > 80g1+40g"- 5"2*3+53*0g"r"\`!#v_40gv>"5"02pv
>                         ^  (greetz to Pinecone_)
0:4g:"$"-!#v_,1+" "02p                                   >            >
           >~@                                                 ^      <
echo  `which {n,y}asm` # why not use FASM instead?   Smile$     >,,,,,, ^
    


Try changing the author's name to "Pinecone" (or whatever). Smile


Last edited by rugxulo on 30 Aug 2009, 16:03; edited 1 time in total
Post 30 Aug 2009, 01:23
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
Bah, bored can't sleep. So I wrote two dopey programs. First doesn't seem to terminate in your Befunge interpreter, so maybe that's the chess bug, who knows.

Code:
    v,,,,,,,,,,,,,,"Hello, world!"+19?91+"!okima ,notulaS",,,,,,,,,,,,,,,,v
    >                                ^                                    <
                                     @
    


Code:
                        v
    "Hello, world!  "+19?91+"!okima ,notulaS"v
    ,,,,,,,,,,,,,,,,@   ^                    >
    
Post 30 Aug 2009, 08:26
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
very good windwakr, i haven't been able to beat 66 bytes for A-Z\na-z\n in brainfuck after trying for several hours today.

the best befunge ide i've found is bequnge its quite wonderful. Smile

rugxulo wrote:
Try changing the author's name to "Pinecone" (or whatever).
Code:
v (written by Pinecone)   > 80g1+40g"- 5"2*3+53*0g"i"\`!#v_40gv>"5"02pv
>                         ^  (greetz to Pinecone_)
0:4g:"$"-!#v_,1+" "02p                                   >            >
           >~@                                                 ^      <
echo  `which {n,y}asm` # why not use FASM instead?   Smile$     >,,,,,, ^
    
The "r" is a pretty big giveaway. Smile try making it part of the code somehow so that it needs to be there for it to execute correctly, instead of just checking it.

rugxulo wrote:
Bah, bored can't sleep. So I wrote two dopey programs. First doesn't seem to terminate in your Befunge interpreter, so maybe that's the chess bug, who knows.
That would probably mean that my ? handler doesn't send the IP north at all. ill add this to the buglist. thanks. and as for it effecting the chess game, i dont think so as the chess game doesn't use the ? instruction anywhere. The following is proof that it wont go up as it will never end.
Code:
v@
>?<
 ^    


Edit: I fixed the bug and re-uploaded it to the thread in Projects and ideas.

I thought of another challenge! (lets try it in brainfuck aswell as befunge Smile)
produce this output:
Code:
ABCDEFGH
Z      I
Y      J
X      K
W      L
V      M
UTSRQPON    


The reason i chose that, was because i couldn't think of any simple way to optimize it, but there may (or at least i hope there will) be with some more complicated algorithms... The challenge will be keeping them small. Ill post a one as soon as i figure out a way to do it :/
Edit: it was much easier than i thought. Razz

Edit: Here's my first try in befunge at 102 bytes:
Code:
<v+55"Z      I"+55"Y      J"+55"X      K"+55"W      L"+55"V      M"+55"NOPQRSTU"
@>"HGFEDCBA">,# :# _~    


Last edited by Pinecone_ on 30 Aug 2009, 19:32; edited 1 time in total
Post 30 Aug 2009, 14:15
View user's profile Send private message Reply with quote
rugxulo



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

The "r" is a pretty big giveaway. Smile


I know, and it doesn't do much either. Obviously I should think up a better joke program idea before writing. (Ever seen one where everything you press becomes "format c:"? That would be funny. Next challenge? Smile )

Quote:

Edit: I fixed the bug and re-uploaded it to the thread in Projects and ideas.


Main .EXE is still the old broken one. The fixed one is in /SOURCE/. (Why?)

Quote:

I thought of another challenge!

The reason i chose that, was because i couldn't think of any simple way to optimize it. The challenge will be keeping them small. Edit: Here's my first try in befunge at 102 bytes


Well, it ain't small at all, but perhaps you can shrink it. I figured the challenge was not to do it the obvious "dumb, hardcoded" way. My way ain't exactly better, but it "feels" better to me. Or not, I suck. Wink

EDIT: Here's smaller (144 instead of 212, heh):

Code:
"A"8v&
    >:!#v_\:,1+\1-
        >"Z"5v
             >91+,:!#v_\:,:50g2/2-:2*50p-"      ",,,,,,,1-\1-
                v8"U"<
    -1\-1,:\_@#:<
    
Post 30 Aug 2009, 16:01
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
Here's one in brainfuck, im sure windwakr will beat it though Smile (135 bytes)
Code:
>++>+++++>>>++++++++++[<+<+++++++++<++++++<+++<+>>>>>-]<--[<<.+>>-]<<<<.>>>>+++++[<.-<<......>.+<<.>>>>-]++++++++<<++++++++>>[<<-.>>-],    


rugxulo wrote:
I know, and it doesn't do much either. Obviously I should think up a better joke program idea before writing. (Ever seen one where everything you press becomes "format c:"? That would be funny. Next challenge? Smile )
I dont quite understand what you mean by that... whenever you press a key it outputs "format C:"?... I'm pretty sure thats not what you mean Razz

rugxulo wrote:
Main .EXE is still the old broken one. The fixed one is in /SOURCE/. (Why?)
Thanks for telling me. I copied the new .exe to the wrong spot Razz Fixed now.

rugxulo wrote:
Well, it ain't small at all, but perhaps you can shrink it. I figured the challenge was not to do it the obvious "dumb, hardcoded" way. My way ain't exactly better, but it "feels" better to me. Or not, I suck. Wink
You're probably right. I wont count the "dumb, hardcoded" way as a solution then Smile but kudos to anyone who can beat the hardcoded way in size.

Ill give a go at writing a "real" one in befunge tomorow. For now, goodnight Smile
Post 30 Aug 2009, 17:27
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
Pinecone_ wrote:
Here's one in brainfuck, im sure windwakr will beat it though Smile (135 bytes)
Code:
>++>+++++>>>++++++++++[<+<+++++++++<++++++<+++<+>>>>>-]<--[<<.+>>-]<<<<.>>>>+++++[<.-<<......>.+<<.>>>>-]++++++++<<++++++++>>[<<-.>>-],    



Don't count on it. My brain is still fucked up from that last one.

_________________
----> * <---- My star, won HERE
Post 30 Aug 2009, 17:46
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16843
Location: In your JS exploiting you and your system
revolution
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 30 Aug 2009, 18:18
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
That will be a tough one revolution. Good thinking.

I couldn't resist trying the square alphabet one before i went to sleep Sad now its 4:35 AM and im considering just staying up all night because if i go to sleep then it will be too hard to wake up when i need to. I need coffee.

I got 99 bytes Smile
Code:
"A"8v >$"Z"5^
1,:\<_^#:-1\+
\-1,:\<_v#:-1
55+,$8^ >~@   >
\-1,:p00,+55<_^#:-1g00\+1,:,,,,,,"      "    


I was quite surprised when i saw it was smaller than the hardcoded one Smile
I wonder if it can be made smaller....

windwakr wrote:
Don't count on it. My brain is still fucked up from that last one.
You did a really good job though Razz

rugxulo, a tip for befunge optimization: squish everything over to the left and use line wrapping as much as possible if it helps get everything to the left, this way you're not wasting bytes on a ton of padding. Also use as few line breaks as possible as they're another byte gone.
Post 30 Aug 2009, 18:29
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
Wow, you're 14 hours ahead of me....You're like, in tomorrow....

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



Joined: 28 Apr 2008
Posts: 180
Pinecone_
When you put it that way, you could say I'm in the future. Razz
Post 30 Aug 2009, 19:01
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
Pinecone_ wrote:
I dont quite understand what you mean by that... whenever you press a key it outputs "format C:"?... I'm pretty sure thats not what you mean Razz


Here's what I mean, but I didn't bother obfuscating it. Feel free (but it's lame either way, heh). Works best with unbuffered input. Wink

Code:
" ? :c tamrof >\:C"91+   92*v
                            >:!#v_\,1-
                                >~$"y",~$"e",~$"s",v
                                  v\,:\< v\"."*:+19<
                                -1<    |:<
                        @,,,,,," Done!"<
    


revolution wrote:

Generate random numbers between 1 and 13 inclusive, the distribution must be uniform.


Something tells me you've already done it before suggesting it. Wink
Post 30 Aug 2009, 19:04
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
rugxulo wrote:
Here's what I mean, but I didn't bother obfuscating it. Feel free (but it's lame either way, heh). Works best with unbuffered input. Wink
Well i need something to do while staying awake all night Smile
Code:
<>:# ,# _# v#"C:\> format C: ?"
"sey"~$,~$v>
~$,99*"."v>,
_v#:-1\,:<\
@>"!enod ">:# ,# _~    


rugxulo wrote:
Something tells me you've already done it before suggesting it. Wink
I've noticed he does that alot.
Post 30 Aug 2009, 19:20
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
Pinecone_ wrote:
That will be a tough one revolution. Good thinking.


No doubt! I can't even imagine a solution right now!

Quote:
I got 99 bytes Smile


Beats me, all I can get is 105.

Code:
#&"UZ"8\5"A"8v
 -1\+1,:\_v#:<
,,,1-\1-::>$$91+,:!#v_\:,:10g2/2-:2*10p-"      ",,,,
    ::-1\-1,:\_@#:$$<
    


Quote:

I was quite surprised when i saw it was smaller than the hardcoded one Smile
I wonder if it can be made smaller....


You should know better by now. Smile It can always be smaller. (Keep hope alive!) Laughing

Quote:

rugxulo, a tip for befunge optimization: squish everything over to the left and use line wrapping as much as possible if it helps get everything to the left, this way you're not wasting bytes on a ton of padding. Also use as few line breaks as possible as they're another byte gone.


Yeah, I just do it the easy way, then optimize later. Of course I think you're better at it than me. Cool
Post 30 Aug 2009, 20:15
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
I'm just starting to get some time to look into Befunge. I'm trying to make a small single-line "Hello, World!" printer without backwards pushing(I mean, not visibly backwards in the code.). Best I've gotten so far is 25 bytes. Anyone have any ideas for optimization?
Code:
<@_,#! #:<"Hello, World!"
    

EDIT:DOH! Forget the exclamation point. >.> It's 25 bytes, updating it....DAMN, after all that brainfuck, I'm seeing ">.>" as brainfuck code.....


UPDATE:
24 bytes now.

Code:
<>:#,_@#:"Hello, World!"
    

The very basic part of it without the string, <>:#,_@#:"" is 11 bytes.

_________________
----> * <---- My star, won HERE
Post 30 Aug 2009, 22:36
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16843
Location: In your JS exploiting you and your system
revolution
rugxulo wrote:
Something tells me you've already done it before suggesting it.
Well let's just say that I guarantee it can be done.
Post 31 Aug 2009, 02:11
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
hey that's great windwakr, i've been using <>:# ,# _@# for ages Razz thanks!

rugxulo wrote:
Yeah, I just do it the easy way, then optimize later. Of course I think you're better at it than me. Cool
I think i just put more time into it Razz

rugxulo wrote:
You should know better by now. It can always be smaller. (Keep hope alive!)
You're right. 97 bytes. (no longer pauses at the end, but that wasn't a requirement)
Code:
"A"8v >$"Z"5^
1,:\<_^#:-1\+  <
55p1*62p16"@-"<^1,:\8$,+
\-1,:p00,+55<_^#:-1g00\+1,:,,,,,,"      "    


revolution wrote:
Well let's just say that I guarantee it can be done.
I'll give it a go later. Gotta finish some assignments today Sad
Post 31 Aug 2009, 02:15
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 ... 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-2019, Tomasz Grysztar.

Powered by rwasa.