john conways game of life

edited October 2016 in How To...

hey i was wondering as to how to make a simple pixel program similar to john conways game of life, i want to make my own particular bit commands were bits react the way i want them and i simply dont know how to develp a simple code to get me working with the enviroment were i can make my own choices on as to how the bits effect each other. maybe somthing like a fibonnacci function of single bits on the screen, like if one bit turns on then, that will turn on another bit, if 2 bits are on that will turn on 3 more etc..

Answers

  • im just looking for somthing simple. my idea is somthing like this

    if a bit is turned on, then that will turn on another bit, and so on reflecting the fibonacci sequence, i dont know if i need to make it be on a screen or not just simply the continuous data flow

  • maybe the number of bits that have turned on, shown on the screen,

  • edited October 2016

    That example sketch may look long, but is a pretty simple implementation of the Conway algorithm -- a 2D bit array and a buffer with some change rules. If you delete keyPressed() interactivity and remove most of the draw() code (since it sounds like you don't want to draw to the screen) there isn't much code left at all. Maybe try that and play around with changing the update rules.

    You could write the whole thing for updating and checking pixels rather than array locations, but you would still need a separate buffer image, so it probably wouldn't be simpler code -- just less flexible.

    If you want something 1-dimensional, you can still copy the approach. Try -- and if you get stuck, share your code with a question for feedback.

  • im just looking for a very simple code, to do simple computing of a fibonnacci sequence, and on the screen show a number of how many bits have turned on as a real number

  • edited October 2016

    I see -- this doesn't really have anything to do with the Game of Life or with cellular automata, then.

    Happy to help!

    Here is the formula for a Fibonacci sequence described on "Math is Fun":

    So we can write the rule:

    The Rule is xn = xn-1 + xn-2

    Once you calculate it, you can show text (such as a number) on the screen using the function:

    Try to make this sketch and then share it. If you have problems, share your properly formatted source code here and ask specific questions for feedback on how to make it work.

  • in the other thread there is a small script providing the fibonaccis values - it's just in QScript, but you can easily copy it

Sign In or Register to comment.