|
Author: bla on June 11 2008
Viewed 3781 times. 9 people liked this blog. You can rate it below if you haven't already.
-->
i need someone to write a (probably) very simple program for me
its to generate a picture of black and white squares (pixels on or off)
i dont know shit about programming (except a bit of zx spectrum basic back in the day) but im pretty sure itd be easy to do for someone whos into coding
theres not much to it- ive been doing it 'by hand' but i always make mistakes so i need to get a computer to do it
anyway, it goes like this:
start in the middle square and go round in a spiral 1 square at a time (might as well be clockwise first going up then right then down, down, left ,left, up , up ,up, right.... etc)
the only rule to determine whether each square is black or white is if theres an even number of black squares adjacent to it then its black, if its an odd number then its white
thats it
i REALLY want to see what it looks like with 1000's of squares but doing it by hand is a real pain and its almost impossible not to make mistakes- ive done it on graph paper to about 100x100 but i need to see it much bigger to see what structures develop in it
if noone fancies it then i guess i could take suggestions for programming languages and tutorials but im a really slow learner
| |
Comments
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
license
bla said: "oh and diagonals do count"
then add
leftup = getPixelValue(x-1,y-1);
rightup = getPixelValue(x+1,y-1);
rightdown = getPixelValue(x+1,y+1);
leftdown = getPixelValue(x-1,y+1);
after
left = getPixelValue(x-1,y);
right = getPixelValue(x+1,y);
up = getPixelValue(x,y-1);
down = getPixelValue(x,y+1);
and change
totalAdjacent = left + right + up + down;
to
totalAdjacent = left + leftup + up + rightup + right + rightdown+ down + leftdown;
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
bla
i just tried a bit of left to right then right to left dot matrix style (by hand in ms paint) and it just repeats at first but then you get all this simmetry breaking (because of the edges i guess) so you do get some chaos
but anyway- forget the row by row idea- the spiral is where its at
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
bla
for some reason i cant spell on the internet
symmetry
is that right?
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
elronhubbard
bla wants to play a chaos game?
expect crazy results.
link
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
bla
yeah- i know that kind of thing but they stay symmetrical so there isnt any chaos really
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
delete
i don't think this qualifies as chaotic either. if you define the center of the spiral, the initial condition (black or white) and the initial direction then there must be a formula that can give the color of the block located at (x,y) coordinates. finding it can be a real headscratcher though, maybe i'll look into some discreet mathematics for this. thanks for the math challenge bla 
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
jogn
Processing is really simple. The setup() function runs just once, and the draw() function runs every cycle. You can use license/cbit code to work on an array, and then based on that array, draw boxes for it, because pixel wise, that's going to be a really small picture.
also you might want to consider this, if you're trying to make a spiral, and you're counting out the increments, with the first insertion right next to the middle start point, every second turn the length increases.
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
jarvis
this sounds like a modified version of cellular automata, only each generation stays and the growth follows a spiral
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
Roshi
bonus points to anyone who can write this in Logo 
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
pillowtalk
I wonder if you could do this in excel with conditional formatting.
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
jogn
i don't know how to bonus points to anyone who can write this in Logo 
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
Roshi
thank god no one said "what's Logo?"
I feel old enuf as is
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
license
lol! 
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
bla
delete - yeah it should be totally determinable- its the same every time- but i think you have to go through each previous step to find if a particular pixel is black or white
i cant begin to imagine this as a maths formula
jarvis- yeah youre right- i thought this up years ago after reading a book about cellular automata
jogn- ill try to give processing a go- im sure i will get it eventually but these days concentrating on new stuff to learn takes me a long time (and i dont smoke THAT much)
bonus points to anyone who can build this in lego
06/11/08
+
PM |
QUOTE |
PERMALINK |
REPORT
fujiyama
you could do this in matlab really easily.
Register / login
|
^
EM411 is Copyright 2001-2008 EM411.com
All rights reserved. | Contact | RSS
|