Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (1)

Powered by Vanilla. Made with Bootstrap.
Drawing plants with Lindenmayer
  • Deque
    Posts: 78
    Hello guys,

    the following is a little program that draws an l-system (or Lindenmayer system).
    L-systems can be and are used to generate plants. It is nice to experiment a bit with the rules. Here is an example:

    [spoiler]http://s1.directupload.net/images/110814/oug6qtee.png[/spoiler]


    You see on the right side how it works. There are two rules you can edit. Let's say the first rule is "A is replaced with AA". The second: "B is replaced with (B)A"
    You specify how the program starts and the depth.

    Now let's say you start with B. That means the program will draw a little line, because B is "forward".

    In the next level B is replaced.
    (B)A
    That means we save the state and turn left ("("), go one line forward ("B"). Now there is a ")" which means we go back to the point where we started drawing B and we draw A.

    Next level the string (B)A is replaced with
    ((B)A)AA
    And so on.

    Download: http://www.mediafire.com/?d5r7rxoda9cs5zf
    LOC: 291 (without empty lines and comments)

    Deque
  • Xin
    Posts: 3,251
    Another interesting program here, did you ever do the ant hill simulation when starting java? They seem to do that everywhere.
    Xin
  • Deque
    Posts: 78
    No I didn't. I don't even know it. Do you program with Java? I've the feeling I am the only one here.

    Our university uses Greenfoot to teach Java. I don't really like that.
  • Xin
    Posts: 3,251
    said:


    No I didn't. I don't even know it. Do you program with Java? I've the feeling I am the only one here.

    Our university uses Greenfoot to teach Java. I don't really like that.



    Nope but ive done some java classes at various places and they all have this ant sim, its quite good, but i couldn't find the source for it on the web.
    Xin
  • Sh3llc0d3
    Posts: 1,910
    Looks interesting, I avoided doing java by changing my degree choice in favour of C/C++.
  • Flashlight
    Posts: 173
    Shell, consider yourself lucky, java is the most horrible language ever, its like you took C++ and took all the good away from it.
  • Sh3llc0d3
    Posts: 1,910
    said:


    Shell, consider yourself lucky, java is the most horrible language ever, its like you took C++ and took all the good away from it.



    Thank you for justifying it! A lot of people I know who are doing IT degree's are doing obj-c or java for mobile development... I don't want to do mobile dev! :)
  • Deque
    Posts: 78
    said:


    Shell, consider yourself lucky, java is the most horrible language ever, its like you took C++ and took all the good away from it.


    What is so horrible about it? I don't see any reason why it should be worse than C++.
    Don't take that wrong, I think there are better languages than Java, but your statement seems very narrow minded to me.

    A lot of people I know who are doing IT degree's are doing obj-c or java for mobile development... I don't want to do mobile dev! :)


    Java is not just mobile development.
  • Sh3llc0d3
    Posts: 1,910
    I know Java isn't just for mobile dev my point was a lot of people I know who are studying it are learning it with the aim of going into mobile dev on their course :).
  • D0WNGRADE
    Posts: 220
    I program for Android and BlackBerry. I do use Java for those only, I know it's not just for mobile development...but that's all I use it for... D:
  • Flashlight
    Posts: 173
    In high school one of the courses i took was Comp Sci and it was focused around java, it doesn't allow for easy debugging(likeC++ where you can), it requires additional framework, it has no "real" use apart from mobile dev, it can't edit files unless given permission and too top it off, its not very flexible. Yes Java has it's uses but for the general consensus it is easier to just use c++ or something like C#
  • Deque
    Posts: 78
    How does it not allow for easy debugging? I can do that with Eclipse very easily and I don't need a framework for it. NetBeans sure has a debugger too.

    Why is it not flexible?

    it has no "real" use apart from mobile dev


    JavaME is only one little part of Java. It is wrong to say that would be the main purpose. There is also J2EE for enterprise applications and powerful additional frameworks for web services, portals, servlets, ...
    The industry for that is pretty big. A lot of standard desktop applications are written with Java too (Jedit, Minecraft, Calibre, ...)
    There is a reason that Java is on first place of the tiobe index (http://www.tiobe.com/index.php/content/ ... index.html)

    How should C++ be easier to use? It is more error-prone because of the weak type-checking, the lack of a garbage collector, the use of pointers, the inconsequent use of OOP. It needs more lines of code to do the same.
    In Java i just compile my code and it runs everywhere. In C++ I have to make an executeable for every platform. I don't see anything easier about that.

    C# is easier, because it is younger and implemented some features much better than Java where Java had to maintain backward compatibility and thus couldn't just change everything. But it is almost only used for Windows development. However, C# was not our focus. The question was, why Java is horrible and worse than C++.

    it can't edit files unless given permission


    What exactly can C++ do with files that Java can't? Java can change file permissions.