flat assembler
Message board for the users of flat assembler.

Index > Heap > Esoteric Programming Challenges!

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



Joined: 28 Apr 2008
Posts: 180
Pinecone_
Something else that's been on my mind... add a check for /c switch (for compile) so i can call befunge.exe /c script.bf script.exe and it will copy itself and the script to script.exe. that way it's all handled by the interpreter and i could even go so far as to add context menu entries to window explorer for .bf scripts saying something along the lines of "create standalone interpreter" and it would be completely seamless. Please share your thoughts on this...


Hmmm... this has kind of lead off topic.. I'll go create a thread in Projects and Ideas and briefly outline the ideas which have popped up here, then we can continue this discussion there.


Last edited by Pinecone_ on 26 Aug 2009, 13:42; edited 2 times in total
Post 26 Aug 2009, 13:00
View user's profile Send private message Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6029
Location: Poland
MHajduk
Pinecone_ wrote:
Something else that's been on my mind... add a check for /c switch (for compile) so i can call befunge.exe /c script.bf script.exe and it will copy itself and the script to script.exe.
It seems to be the best solution so far.

You could also consider another way of compilation of Befunge programs: because your interpreter is open source and you attach FASM compiler to your distribution, you can just add desired Befunge program code to the interpreter source and compile it with FASM to obtain "properly" built exe file (Befunge executable).
Post 26 Aug 2009, 13:37
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
New thread has been created in projects and ideas forum. Befunge Interpreter

Please continue any discussions about the interpreter in that thread.

My response to the above post is here: http://board.flatassembler.net/topic.php?p=100360#100360
Post 26 Aug 2009, 13:54
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7498
Location: Kraków, Poland
Tomasz Grysztar
This thread inspired me to invent another similar language (but register-based, instead of stack; and without output instructions). I'm going to share my idea with you as soon, as I prepare some interesting samples. Wink
Post 26 Aug 2009, 15:50
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
Does anyone have a good compile of bef.c they can upload? I compiled it in TCC, but a lot of befunge programs make it give errors.
Rugxulo's program gives this in my compiled bef.c
bef.c wrote:

ABCDEFGHIJKLMNOPQRSTUVWXYZ
Unsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
abcdefghijklmnopqrstuvwxyz


Pinecone_'s gives a ton of errors.

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



Joined: 28 Apr 2008
Posts: 180
Pinecone_
What are the errors mine is giving?

i can run it fine... you are talking about one of the befunge scripts he posted right?
rugxulo wrote:
Code:
   93*1-"A"v     >
 v!:-1\+1,:<
v_\        ^
>91+,"a"90p"@"02p^    

rugxulo wrote:
Code:
>"A"93*1-\  v
  v!:-1\+1,:<
 v_\        ^
^>91+,"a"20p"@"12p>     


They both ran fine for me in my interpreter and gave the right output...

Tomasz Grysztar wrote:
This thread inspired me to invent another similar language (but register-based, instead of stack; and without output instructions). I'm going to share my idea with you as soon, as I prepare some interesting samples. Wink


Sounds awesome. But what would be the use of it without output instructions?
Post 26 Aug 2009, 22:36
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
I'm talking about the bef.c interpreter, not yours. Yours runs those programs fine, but doesn't run a lot of the examples in the scripts folder. So I tried making bef.c with TCC, but it doesn't seem to work right. Here's error on yours in bef.c interpreter.

"A#"9-v >91+,"~@ a"10p162*+0p
1,:\-1<_^#:\+
bef.c wrote:

Befunge-93 Interpreter/Debugger v2.21
AUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
BUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
CUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
DUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
EUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
FUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
GUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
HUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
IUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
JUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
KUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
LUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
MUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
NUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
OUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
PUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
QUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
RUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
SUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
TUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
UUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
VUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
WUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
XUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
YUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
ZUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)

aUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
bUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
cUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
dUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
eUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
fUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
gUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
hUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
iUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
jUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
kUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
lUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
mUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
nUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
oUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
pUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
qUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
rUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
sUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
tUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
uUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
vUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
wUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
xUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
yUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)
zUnsupported instruction ' ' (0xffffffff) (maybe not Befunge-93?)

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



Joined: 28 Apr 2008
Posts: 180
Pinecone_
Could you try running this in it please?
Code:
v                             <
>"A#"9-v >91+,"~@ a"21p262*+1p^
v1,:\-1<_^#:\+<
>             ^    

If that works, then I think that interpreter doesn't handle wrapping either side of the fungespace (playfield) how it should.

That code is practically the same as
Code:
"A#"9-v >91+,"~@ a"10p162*+0p
1,:\-1<_^#:\+     
but with arrows directing execution around instead of relying on wrapping from one side to the other.


Last edited by Pinecone_ on 27 Aug 2009, 00:08; edited 1 time in total
Post 26 Aug 2009, 23:16
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
Yes, that works right. I wonder why the "official" interpreter doesn't handle wrapping right. Or, it could be a problem with using TCC to compile it.

EDIT: Must be the compiler, TCC, here's the code that handles the position in the source. I wonder why it doesn't compile right or something:
Code:
x += dx;
y += dy;
      if (x < 0)
   if (v10err_compat)
  {
        x = LINEWIDTH;
    } else
 {
        x = LINEWIDTH - 1;
        }
      else
        x = x % LINEWIDTH;
      if (y < 0)
   if (v10err_compat)
  {
        y = PAGEHEIGHT;
   } else
 {
        y = PAGEHEIGHT - 1;
       }
      else
        y = y % PAGEHEIGHT;

    

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


Last edited by windwakr on 27 Aug 2009, 00:17; edited 2 times in total
Post 26 Aug 2009, 23:53
View user's profile Send private message Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
windwakr wrote:
Or, it could be a problem with using TCC to compile it.
Probably the best bet, how weird would it be if the official interpreter didn't support its own standards... Just to be sure, could someone test my script with a bef.c compiled with a different c compiler?

Edit: never mind.

I have no idea why that isn't compiling right... How strange.
Post 27 Aug 2009, 00:16
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7498
Location: Kraków, Poland
Tomasz Grysztar
Pinecone_ wrote:
Sounds awesome. But what would be the use of it without output instructions?
Because of the self-modifying abilities, you can simply use parts of program plane for various outputs, event "paint" there. I feel the additional output instructions are not really needed in this kind of languages.
Post 27 Aug 2009, 06:20
View user's profile Send private message Visit poster's website Reply with quote
Pinecone_



Joined: 28 Apr 2008
Posts: 180
Pinecone_
Makes sense, and might even make it more fun to program in Smile Good luck and keep us informed.

Edit: 38 bytes! Smile
Code:
"A4"v >91+,"@~a"10p92+0p
:\-2<_^#:\+1,    


I think it's time to think of a new challenge, one which will be a little more interesting than the alphabet... Any suggestions?

Once we decide upon a good one, i will update the first post.

windwakr, I beat your brainfuck code for A-Z a-z in size Razz Yours is 118 bytes, mine is 85 bytes.
Code:
>++++++[<++++++++++>-]<->++>++++++++++<[<++++++>>>>+++++[<+++++>-]<+[<<<.+>>>-]<.<-],    
Post 27 Aug 2009, 09:55
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
Pinecone_ wrote:
rugxulo wrote:
EDIT: Okay, 62 bytes, wow, big improvement I know (not). Heh.


Hope that was understandable and if it was that it helps Smile good luck getting it smaller Smile feel free to cheat and modify mine if you can make them smaller.


Yes, very good tips, I'll take a look later.

rugxulo wrote:
Only a Windows version? *sniff*


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).

Pinecone_ wrote:

rugxulo wrote:
However, just the idea of chess can make somebody very impressed. Wink

I saw that a few days ago, but it doesn't seem to run in my interpreter. Does anyone know why? Maybe i implimented something slightly wrong... or maybe i just dont know how to move properly Razz if anyone can help, please post Smile I'd really like to see that chess game in my interpreter Razz


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.

EDIT: Even when it works, moves aren't verified, which is slightly dangerous (cheating!), but hey, you can't have everything. Wink

EDIT#2: Here's a compat.bf Befunge program somebody wrote to help test your interpreter. Try it, and see if that helps isolate the issue.

Pinecone_ wrote:

rugxulo wrote:
Big thanks for sharing. Smile

No Problem Smile I wasn't gonna let all this work go to waste Razz


Good! Very enjoyable topic. Smile


Last edited by rugxulo on 29 Aug 2009, 05:23; edited 1 time in total
Post 29 Aug 2009, 03:13
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
Pinecone_ wrote:
windwakr wrote:
Or, it could be a problem with using TCC to compile it.
Probably the best bet, how weird would it be if the official interpreter didn't support its own standards... Just to be sure, could someone test my script with a bef.c compiled with a different c compiler?

Edit: never mind.

I have no idea why that isn't compiling right... How strange.


You mean TCC as in TinyC? No idea. But here's my compile (if it helps you):

Quote:

Your file has been saved and can now be downloaded 10 times. It will be deleted after 90 days without download.

http://rapidshare.com/files/272842799/bef-dj.zip.html
MD5: 56269F9E95F2A05E6D036CAE671DF73F


P.S. Didn't want to waste attachment space for this, and it includes full sources too (to comply with license).
Post 29 Aug 2009, 03: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
Odd, I still get that error with his program on your compile. Thanks anyways.

_________________
----> * <---- My star, won HERE
Post 29 Aug 2009, 03:33
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 think it's time to think of a new challenge, one which will be a little more interesting than the alphabet... Any suggestions?

Once we decide upon a good one, i will update the first post.


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.

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


Other good (but boring??) ideas (already been done before) are pi, rot13, rpn, sierpinski, factorial.

Personally, I wrote a few silly progs (mostly boring like the alphabet one):


  • prints "FASM rulez" in ANSI colors (though hardcoded string length)
  • countdown 26 to 1 (without manually pushing each number)
  • alphabet: [a-z], [a-zA-Z]


My favorite so far (mostly useless) is "Hello, world!". Wink But the point was I wanted something that was easy to modify, and I didn't like pushing backwards, and I also didn't like hardcoded lengths or having to mix instructions and data on one line or any of that crud.

Code:
0:1g:"$"-!#@_,1+" "00p
Hello, world!$       (string must be at start of line 2 and end in '$')
    


I think that is way more useful and easy to use. (Makes a silly "FASM rulez" much easier to make, too.)

Okay, I know it's not much, but whatever. Wink

EDIT: I should make this my new sig. Smile
EDIT#2: Hmmm, guess it doesn't allow \x1b in sigs, so I'll have to "pretend" via \e.


Last edited by rugxulo on 29 Aug 2009, 03:55; edited 1 time in total
Post 29 Aug 2009, 03:43
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_ wrote:
windwakr, I beat your brainfuck code for A-Z a-z in size Razz Yours is 118 bytes, mine is 85 bytes.
Code:
>++++++[<++++++++++>-]<->++>++++++++++<[<++++++>>>>+++++[<+++++>-]<+[<<<.+>>>-]<.<-],    



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


I borrowed a few ideas from yours.

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


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



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
Only 79 bytes without any linefeeds. Wink But at least BFD compiles it to a measly 262 bytes. Laughing

EDIT: I mean 79 bytes + 1 for *nix LF = 80, so that's the true size.

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


Last edited by rugxulo on 29 Aug 2009, 04:00; edited 1 time in total
Post 29 Aug 2009, 03:56
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
Without any linefeeds? It prints a 10 after each line, just like Pinecone_'s.

EDIT: Ya rugxulo, I've seen that. Funny stuff. That guy has a lot of interesting befunge stuff.
Too bad that awesome looking visualizer requires PERL.....

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



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
windwakr wrote:
Odd, I still get that error with his program on your compile. Thanks anyways.


Code:

[ Vista ] - Fri 08/28/2009 >cat moo.bef
"A#"9-v >91+,"~@ a"10p162*+0p
1,:\-1<_^#:\+

[ Vista ] - Fri 08/28/2009 >befunge moo.bef
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz

[ Vista ] - Fri 08/28/2009 >..\bef -q moo.bef
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz


[ Vista ] - Fri 08/28/2009 >ver

Microsoft Windows [Version 6.0.6002]

[ Vista ] - Fri 08/28/2009 >scrndump
    
Post 29 Aug 2009, 04:09
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, ... 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.