Nice little Mandelbrot (ASCII Art)

Since we do not have native C compilers on the Oric, this forum will be mostly be used by people using CC65 or the OSDK. But any general C related post will be welcome !
Post Reply
User avatar
waskol
Flight Lieutenant
Posts: 331
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Nice little Mandelbrot (ASCII Art)

Post by waskol » Tue Dec 15, 2009 10:10 am

With your OSDK, just build this and enjoy :D

Code: Select all

int main()
{
  int k = 2;
  float i,j,r,x,y=-16,columns=37; 
  cls();
  paper(0); ink(7);
  while (puts(""), y++<15)
    for (x=0; x++<columns; putchar(" .:-;!/>)|&IH%*#"[k&15]))
      for (i=k=r=0;
           j=r*r-i*i-2+(x*84/columns)/25,i=2*r*i+y/10,j*j+i*i<11&&k++<111;
           r=j);
  getchar();
  return 0;
}
Last edited by waskol on Wed Dec 16, 2009 5:21 pm, edited 1 time in total.

User avatar
carlsson
Pilot Officer
Posts: 127
Joined: Thu Jan 12, 2006 11:26 pm
Location: Västerås, Sweden

Post by carlsson » Wed Dec 16, 2009 2:50 pm

Yowsa, that is not the kind of C teached in schoolbooks. While in no way obfuscated, it utilizes the loop constructs quite a lot.
Anders Carlsson

User avatar
Dbug
Site Admin
Posts: 2324
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post by Dbug » Wed Dec 16, 2009 10:02 pm

Crap, tried to build it, obviously I broke the linker :(
One more bug in my new version of the osdk...

User avatar
waskol
Flight Lieutenant
Posts: 331
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Post by waskol » Thu Dec 17, 2009 9:07 am

carlsson wrote:Yowsa, that is not the kind of C teached in schoolbooks. While in no way obfuscated, it utilizes the loop constructs quite a lot.
Yes, I know, but this is not my work. I just adapted it (in order to fit the number of columns of the Text mode), from a windows source code.

@debug : it compiles here, guaranteed !
I wanted to ask you : are you sure you want to keep the system of batch files for compilation and so forth for your OSDK ? We could use instead some more elaborated scripting engine such like AutoIt, what do you think ?

User avatar
Dbug
Site Admin
Posts: 2324
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post by Dbug » Thu Dec 17, 2009 12:00 pm

I'm definitely not going to replace the batch file system by something that works only on windows:

"Compatible with Windows 95 / 98 / ME / NT4 / 2000 / XP / 2003 / Vista / 2008"

Basically, I want something that ideally would:
- be simple to use and modify
- possibly is already installed with the system, or only require a minimum install
- possibly free and open

Now the question is, what is the problem with the batch file, what kind of more elaborate thing you wanted to do ?

User avatar
ibisum
Squad Leader
Posts: 850
Joined: Fri Apr 03, 2009 8:56 am

Post by ibisum » Fri Dec 18, 2009 1:11 pm

(I'd give anything to have this working on Linux. Any possibility?)

User avatar
Chema
Game master
Posts: 1972
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Post by Chema » Fri Dec 18, 2009 2:01 pm

Dbug wrote:Now the question is, what is the problem with the batch file, what kind of more elaborate thing you wanted to do ?
:lol: This is a recurrent topic... And I think nobody has, till now, gave a good reason for Dbug to drop the batch file system. I also find it really useful, quite easy to change and possibly very easy to port to other OSes.

Granted it does some ugly things with the output and how Euphoric is called, directories with some old files (I remember I had to clean the tmp or bin, don't remember which, as I was having compiling errors -- also I went ARGH many times after running the bat for cleaning the tmp directories and discover it deleted the tap and dsk files I had on the Euphoric's dir) and such, but I frankly cannot imagine another way to do these, which do not depend on using batch files or any other tool.

I'd say that, with the size of Space:1999 and 1337 (Elite-clone) and how they call external tools for several matters, I start to miss a good "make" to avoid recompiling what has not changed, but it is not enough to even consider switching to it, I think.

Better have a full C compiler (I remember errors in the string handling, itoa and such) without bugs... then we'll see :)

User avatar
Dbug
Site Admin
Posts: 2324
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post by Dbug » Fri Dec 18, 2009 2:49 pm

ibisum wrote:(I'd give anything to have this working on Linux. Any possibility?)
Well, there is no (finished) native linux port, but it works 100% correctly using Wine, I used it few times already, and it works even on my eeePC running Ubuntu.

Should give a try at least.

Not perfect, sure, but it's working.

User avatar
ibisum
Squad Leader
Posts: 850
Joined: Fri Apr 03, 2009 8:56 am

Post by ibisum » Mon Dec 21, 2009 12:45 pm

I'll give a try under WINE .. but one stupid question: wasn't there a native C compiler for the Oric Atmos at some point, which could be used to build full-blown apps? I must confess to becoming more and more foggy over the years about such things, and was never quite savvy with it in the good ol' days either, not having ever had a microdrive to play with .. :(

User avatar
Chema
Game master
Posts: 1972
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Post by Chema » Mon Dec 21, 2009 5:16 pm

Yep. There was a linux version of lcc or rcc or were both the same? I used it to build pinforic, but don't remember the details.. :(

I noticed that in http://oric.free.fr/software.html there is no more a link to a linux version, even if all the components should be in http://oric.free.fr/COMPILERS... but you would need to download them separately and make everything work.

I remember using make to build the pinforic executable under linux. Pitty I lost that disk...

If I find more information I will post it here.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest