flat assembler
Message board for the users of flat assembler.

flat assembler > Heap > Esoteric Programming Challenges!

Goto page Previous  1, 2, 3 ... 9, 10, 11, 12  Next
Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16632
Location: In your JS exploiting you and your system
Tomasz Grysztar wrote:
As I see it, all the programs we've made so far (including the one that received the star) DO use the same ? more than once. Clearly, if you have this kind of instruction block in your code:
Code:
>?<    

then this ? instruction is the most probably going to be executed more than once.
Yep, so you need to find another method. Wink
Post 09 Sep 2009, 15:21
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
It's not to hard to come up with something to do that... but my binary method needs to loop back to the start if the number is >= 14... which would re-execute ? commands.

Is that method plausible now? and if not, is there another method we haven't thought of yet?
Post 09 Sep 2009, 16:31
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16632
Location: In your JS exploiting you and your system
I say: it can be done. Now you just have to find the way. Wink
Post 09 Sep 2009, 16:38
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Ahh my binary method will work, but it'll require a fair bit more checking. I'll do that another night (probably around 20 - 24 hours from the time of posting this).
Post 09 Sep 2009, 16:47
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2335
Location: Usono (aka, USA)
Okay, so I was fiddling with my "star" program, trying to get it to work with slightly-compressed text. Long story short: star is boring, but this translation/example of mine might seem a bit more interesting. Wink

(compatibility notes):

BTW, Jesse Ziser's Befungus is an old DOS IDE/interpreter/compiler (no srcs, bloaty debug info), but it fails on that (why??). Also Ryan Kusnery's tiny BEFI.COM DOS interpreter fails unless you remove the first comment line (EDIT: chokes on "=") and put 0 at the end of the next line.

Also found Ben Olmstead's MTFI, a Befunge-93/-96/-97 interpreter in C (with 8086 compile!) which also supports DJGPP for faster behavior. Apparently MS C's tmpfile needs C:\ (which Vista forbids) but otherwise it (would) work fine (e.g. DOSBox, real DOS, etc). Oh, and I know it's unrelated, but a nice signature for Befunge-97 (only) is here (noticeably faster with MTFI 386 compile).

Enjoy! Laughing

Code:
v (guess who, gleaned from 4th example; in 4DOS: "set .bef=bef -q^guesswho")
<v" X"5" X!"/2"& "+49"X *   *"7" X"5" X!"
 <v"    X  XX!"*27" XX"*62" XXXX   "6"X/"5" X"5" XXXX!"*44" XXX"+49" XX***"9
  <v" XXXX!"+92" X"+49" X"9" "8"X\"5" XX   XX  X!"*26" XX"*26" XX"*27" X"5" X"
   <v+19" X    XXX"6" X"8" X"*35" X  X X  X!"+19" X"/4"4 X"9" X"*72" XX X "
    <v"   X    X    X"8" X"/2"( XX!"9" X    X   X    X"8" X"/3"3 XXX  XX!"
     <v"    X"+19" X!"8" X    X   X"5" X"9" X!"8" X    X    X    X"8" X!"9" X"
      <v9" X"9" //   X"/2": XX!"8" X"9" //    X"+19" "*29"X/!"8" X"5" XXX//"
       <v" X"8" XX    XX"5" X"/2", X***X!"+19" X"9" //XXXX"7" X"/2", XXXX!"
        <v"   X "6"*  "9"X"*28" XX XXX!"*62" XX"6" X ****  X"*93" X** X!"+92
         <v5"*  X"*62" XXX"5" XX!"*82" XXXX "7"* XXX"6" XXXX"+91" XX!"*72" XX"
          <v/2", XXXX!"*37" X    XX!"/2"( X  ***  X"*28" "5"X!"/2"& X  "
 v         <
 >:!#@_:"!"-  v
 ^   ,_v#`*56:_91+,$
#| #$_ >1-\:,\:!
    


EDIT: I didn't worry about size, esp. 'cause I didn't want to "push the limits" and have 80 columns (well, 80 + 1 for LF) which some implementations might choke on.


Last edited by rugxulo on 10 Sep 2009, 23:29; edited 1 time in total
Post 09 Sep 2009, 18:51
View user's profile Send private message Visit poster's website Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
EDIT: Bug with big divisor....ugh.....

Just a test with fractional precision when dividing two whole numbers. You SHOULD be able to have precision up to 2^31-1, but I haven't tested that.

Code:
<>:#,_v#:"Dividend?"+55
55p00&<>:#,_v#:"Divisor?"+
00g01g/.~@  >&:01p00g\%:0`#v_01-`!#v_" :tneitouQ",,,,,,,,,,
10g00,,,,,,,,,,"Quotient: "<       <v.:%g10g00,,"r ".:/g
0&,,,,,,,,,,,,,,:+55"Precision? "+55<  vp2
vg10,8./g10:*+19\_v#`0:<g20,".",8.\,+55<
                @~<
>%\1-                  ^
    


Next up, figure out how the hell I would handle fractional input. Would need to use ASCII input, with checks for "-", ".", and 0-9. And somehow turn it into a usable number......forget it.



Sample output(verified correct):
Code:
Dividend?
8879
Divisor?
45678
Quotient: 0 r 8879

Precision?
256

0.19438241604273392004903892464643811025001094618853715136389509172905994132842
9440868689522308332238714479618196943824160427339200490389246464381102500109461
8853715136389509172905994132842944086868952230833223871447961819694382416042733
920049038924646438110
    

_________________
----> * <---- My star, won HERE
Post 09 Sep 2009, 21:05
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7289
Location: Kraków, Poland
You forgot to update the challenge 4. Wink
Post 10 Sep 2009, 08:29
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Tomasz Grysztar wrote:
You forgot to update the challenge 4.
Sorry. Updated now. Smile
Post 10 Sep 2009, 08:43
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2335
Location: Usono (aka, USA)
Nice work, windwakr, although I admit I haven't tested it (yet?) because it's beyond my interest and expertise (heh, what expertise??). Cool
Post 10 Sep 2009, 23:31
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
I thought of a new challenge: Get a number from the user with the & command and print it out in reverse.

e.g. the user enters "12345" return "54321".

Edit: while adding it to the first post I thought i'd change it to this:
Get a number from the user, multiply it by 2 and print it out in reverse.

e.g. the user enters "12345" return "09642" (12345 * 2 = 24690).

Now to go look up decimal-to-ascii and ascii-to-decimal stuff :p
Post 12 Sep 2009, 03:34
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
Here's my entry:
UPDATE, 24 BYTES
Code:
&2*>#v:_@
1+/^ >91+%.8,9
    

Took maybe 5mins to come up with that.



Sample output:
Code:
>befunge reverse.bef
12345
09642
    




The only programming I've done in the last few weeks has been brainfuck and Befunge programming, lol. I haven't even looked at any assembly lately...

_________________
----> * <---- My star, won HERE
Post 12 Sep 2009, 04:10
View user's profile Send private message Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
I thought it'd be easy with befunge... I was thinking of brainfuck mostly when i thought of it.
Post 12 Sep 2009, 08:36
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
Pinecone_ wrote:
...Get a number from the user with the & command...


Thinking of brainfuck when you wrote it, eh? Since when does brainfuck have the "&" command? Seems to me that you didn't think it would be so easy to do, and now you are trying to change it to brainfuck.

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


Joined: 24 Aug 2004
Posts: 16632
Location: In your JS exploiting you and your system
This is just a random thought, this is not related to any other posting in this thread. Wink I have always found that the better challenges are the ones we solve ourselves first. That way any "dumb" or easy challenges can be filtered out before they are even posted.
Post 12 Sep 2009, 22:30
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
windwakr wrote:
Thinking of brainfuck when you wrote it, eh? Since when does brainfuck have the "&" command? Seems to me that you didn't think it would be so easy to do, and now you are trying to change it to brainfuck.
I didn't know quite how easy it would be for befunge, but didnt think it would be too bad.. but i was thinking for brainfuck it could be interesting with converting to a number and back to ascii... of course i was still thinking partly of befunge at first which is why i got the & command thing in there :p but yeah i think revolution has a point there about solving it beforehand
Post 13 Sep 2009, 01:19
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2468
Location: Bucharest, Romania
windwakr wrote:
The only programming I've done in the last few weeks has been brainfuck and Befunge programming, lol. I haven't even looked at any assembly lately...
Be careful not to fuck your brain. Razz

_________________
Previously known as The_Grey_Beast
Post 13 Sep 2009, 14:42
View user's profile Send private message Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Borsuc wrote:
Be careful not to fuck your brain.
Feel like joining in? Smile
Post 13 Sep 2009, 14:48
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2468
Location: Bucharest, Romania
Nah, looks too obfuscated for my tastes, sorry Laughing

_________________
Previously known as The_Grey_Beast
Post 13 Sep 2009, 14:50
View user's profile Send private message Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Borsuc wrote:
Nah, looks too obfuscated for my tastes, sorry
Heh, I'm thinking of writing my own befunge variant, which will allow instruction remapping (among a few other new ideas) Razz

just for an example of the instruction remapping thing... you could make | do v while v does * and * rotates the top three values on the stack, etc Razz or you could just leave the instructions how they normally are Razz just thought a little extra obfuscation wouldn't hurt Smile
Post 13 Sep 2009, 15:05
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2335
Location: Usono (aka, USA)
Lame idea: name your Befunge knockoff "SeaSponge". Smile
Post 15 Sep 2009, 08:13
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, 3 ... 9, 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.