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

Report as inappropriate.

Super_Hippo presents ...


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

1524 views / 254 in the last 7 days

Tags: simulation muster pattern

There is no HTML 5 translation of this scenario available.
View legacy version (requires Java plugin)

This scenarios uses Java features that are not available for use after conversion to HTML 5. Please try the legacy version, which requires the Java plugin to be installed.

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.


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.


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.