This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

Super_Hippo
Super_Hippo presents ...

2013/12/14

Pattern / Muster

First of all, I do not know if pattern is the right translation.
(Neither am I sure about the translations of the next paragraph.)

I painted the one with two and the one with nine colors (not finished yet) on a piece of paper. Actually on the board of the paper bloc...

I decided to program it on Greenfoot and here it is.

At first, you can define four different variables.
(For that, I used Busch's code which can be seen here: http://www.greenfoot.org/topics/find/29144#post_29144 .)
Use only Ints here! No "0" allowed. Would not make sense anyway.
The width of the world. The height of the world. The size of each cell and the number of colors (max. 12).

The last thing is the biggest problem. I have no idea how I could make the decision of the colors depending on the total number of different numbers so there would be the whole range of the RGB used in a way that the colors are not too similar. Doing it just random could can end in same (or almost same) colors which of course look the same.
That is why the colors are always fixed to the number they represent:

1 = red
2 = orange
3 = yellow
4 = lightgreen
5 = green
6 = lightblue
7 = blue
8 = purple
9 = brown
10 = black
11 = grey
12 = white


I am not sure if you can set the width and height of the world to "infinity" in the gallery. I suggest to start with small numbers and see for what your computer, your connection or maybe just grenfoot is fast enough for.

Have fun!

2102 views / 14 in the last 7 days

Tags: simulation muster pattern

Your browser is ignoring the <APPLET> tag.
HTML5 version not available | Scenario not running?
A new version of this scenario was uploaded on Sat Dec 14 22:33:29 UTC 2013 Changed size of the screen which does not change itself on the gallery... How big should it be? Let me know.
Super_HippoSuper_Hippo

2013/12/14

Something is wrong here...
A new version of this scenario was uploaded on Sat Dec 14 22:40:39 UTC 2013 Maybe working now?
A new version of this scenario was uploaded on Sat Dec 14 22:43:06 UTC 2013 Very interesting, but it should work now.
Super_HippoSuper_Hippo

2013/12/14

The creating of the world happens immediately here instead of taking time based on the width and height when open it in Greenfoot. But here, it seems to produce some errors. The screen is shaking in a big world.... Does not effect the result, but it looks ugly.

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.