Powder Physics Games - physics

Does anyone have any experience with this sort of thing?
I'm talking about applets like this http://dan-ball.jp/en/javagame/dust/
I'm really interested in how they work, it seems more like fluid-dynamics than regular game physics. Does anyone know any open source variations, or any hints on how they might work? I think it would be really fun and challenging to work on something like this, but I'm not sure where to start researching...
Thanks :)

One place you can look is at Processing.org. There you can find some examples of those types of programs, including the source and some decent explanations. It is java-like, but not entirely java.

I've played around with both phys2d and jbox2d. I find Phys2d is easier to use.

Related

Is it possible to add youtube/social media links to code comments?

I think it would help explain the code better, but what do I know, I am just a newbie, an alternative would be little audio notes as code comments.
Is this allowed, possible, desirable, or I am just saying incoherent stuff here?
There would be a lot of practical issues that would make audio notes embedded in source code problematic.
However...
You may be someone who thinks best when speaking to another person, and not someone who finds it natural to articulate their thoughts when writing. If that is the case, find out which text-to-speech converters you like best, and use them to dictate your thoughts. Then embed the text into the program source as comments.

How to go about learning R-tree?

I'm currently taking part in a "Data modeling" course. And for my final project, I need to make a research about "R-tree index for spatial searching". However, I'm not at all familiar with many concepts concerning the subject matter (spatial data, multi-dimentional data,...).So, I read the wiki and as I encountered new concepts, I tried to learn them on the way.
However, I don't think this top-down approach is a very efficient way to go about this. Thus, I'd really appreciate it if anybody can suggest a way/lists of things that I need to read up in advance, in order to understand R-tree, and hopefully make some kind of implementation out of it.
Start with the original paper and check out (shameless self promotion) a basic R-Tree implementation in Java.

Does anyone have a SlickGrid wrapper for Haxe?

I am using the Haxe multi-platform programming tool (http://haxe.org) which, among other things, can generate JavaScript output. I would like to know if anyone has already done a "wrapper" library to interface Haxe with SlickGrid.
Doesn't look like one exists yet... sorry!
Unless someone has made one but just not shared it. Could be worth asking on the haxe mailing list / google group? You'll get a wider audience than on stack overflow.
If it looks like no one has done it, you can write your own... it's probably quite do-able. And not too hard either. I'd be happy to help you figure it out as you go... cause I might want to use it one day too :)
If you do decide to take that route I think the best option is to post on the mailing list, and we can help you out from there. There's also a document on the wiki with some instructions:
http://haxe.org/doc/js/extern_libraries
This stuff is always a bit daunting when you first get started, but don't be afraid to ask for help and hopefully you'll be up and running in no time.

Information about Evolutionary Art

I have begun to do some research about Evolutionary Art algorithm. I read a lot of documents about it. But it seems not easy to understand.
The website http://picbreeder.com is a great example for this. But I don't need this in the beginning because it is too complex.
Where can I find some simple code about this in Java? I think read code could help me much.
Thanks!!!
"Evolutionary Design by Computers" By David Bentley (amazon) has a couple of chapters on evolutionary art. However i dont think it includes any code / pseudocode. The canonical GA should do all you need, however the termination condition could be tricky as art is a subjective subject. (Not objective and therefore enumerable)
Hope this helps...
It looks like the EJC library might help you out, and it looks like a number of open source projects/tools come up if you Google for "java evolutionary computing."
I don't know how simple it is, and believe me it needs to be cleaned up a bit, but I have something that might get you started at https://github.com/murmux/Evo/tree/master/assignment2c It doesn't deal with art, rather game theory, but you can use it under the terms of the GPLv3 if you'd like. That uses Genetic Programming... I have another example using a more vanilla EA I might put up later.
Instead of evolving programs to play "Iterated Prisoner's Dilemma," you would evolve programs to generate an art work. The fun part is coming up with a way to "score" an image for its fitness. (Although Picbreeder seems to skip scoring by having you pick the mating pool directly...)
Check this app: EvoPic, its An evolutionary picture creator that uses Steady-State Genetic Algorithm, to produce evolutionary pictures by drawing uni-code characters in a picture box.
Example:

How to explain to a high school hacker that indenting and verbose variable names are good things?

He is good programmer (won some competitions) but he absolutely ignores formatting.
He consider i, j, k beautiful... I hope he won't find out about existence of goto keyword.
Write some code in his "style" and then ask him to read it and explain to you what it is doing.
What's good for the goose and all...
I told my students (post-secondary) that they had the choice of writing code well or of me writing their assignments in the same sort of way that they wrote their code. I told them I would write the following program:
take the text of the assignment
lookup a number of the words in a thesaurus and replace them with obscure versions
remove all punctuation
remove all whitespace
convert everything to lower case
insert random whitespace
capitalize random letters
They could then have the assignment... hey its "right" (all of the words are there) good luck understanding what the assignment is though.
Oddly the complaints stopped at that point :-)
I also compared it to English. We use paragraph breaks, capitalizations, etc... as a convention. When someone chooses not to follow the conventions it makes reading much harder.
tell him about python :)
Make him maintain somebody else's code that's written the way he writes. Then make him maintain somebody else's code that was written with good style.
A combination of FORTRAN77 and Python should sort him out.
Code maintainability
Stuff I didn't care in high school neither :)
Write a bunch of "his" code and ask him to find a particular piece of code.
Give him some badly written code with a bug in it and ask him to find the bug.
Well, if he plans to do this for a living just explain that he will have a very rough life on a real team if he doesn't at least make some effort to follow the team standards. If he doesn't plan to do it for a living, don't worry about it.
You also might determine if there is anyone(s) that he admires. If there is then there is a pretty good chance that they follow standards.
I would point out that having clean code is a sign of a organized and intelligent mind. However, the real killer will be when he writes a large amount of code. I doubt you will be able to convince him because more than likely he is getting excited about the logic of the app and not the process. It will take experience to teach him a harsh lesson. So here are my suggestions.
Give him a project full of messy unformatted poorly named code and let him suffer.
Encourage him to work on a project with a large code base and let him see how well he remembers his own variable names after the 1,000th source file.
You probably can't.
Some people just don't get it.
I use self-describing variable names both at work and in private where noone tells me to. I also got some appreciation at work for using long and understandable names.
If a guy does not do it neither for himself or for your project then you've got that kind of guy. Show him some docs on the source code style policy. Explain why this is important.
You begin to use the right naming convention after you've got some experience and you see how and why this was useful. Without experience it's just an abstract talk.
P.S. Sometimes I get stuck with variable names because I'm not sure if this particular name does conform to the common linguistic style I use in the current project or how would the name scale on the high litterature language. The problem of using bool b1 vs. bool IsSomePropertyAvailable has never come up since the first university years.
I'm pretty sure you can misconfigure a code beautifier to present such horrible output. Obfuscaters are common, and do essentially the same thing (short useless variable names, no indenting, poor use of whitespace).
Give him the assignment of taking an existing program with his style and adding a trivial feature.
Also, take code he wrote 6 months or more ago and give the same assignment.
-Adam
Maybe he's not ignorant, maybe he's just inspired by Kernighan & Pike.
i,j,k is fine for loops.
I personally prefer using 1 letter vars in iterations...
foreach ($test as $t)
{
}
beautiful :D