Qbasicnews.com

Full Version: Cool Program
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I read about a simple program that you can make in just a few minutes. It's pretty cool, so try it:

Use a screen mode w/ high res and PSET a single pixel on the top row.

Have a loop that goes through pixel by pixel. The pixel is either colored or left blank based on the binary sequence of the pixels above it. For example, you could have it go so if the 3 pixels above it were 1, 0, 1, then that it becomes on.

The 3 pixels have 2 ^ 3 = 8 combinations you need to take care of.

If you randomize the different combinations that either turn the pixel on or off, different designs are created, including some fractals.

Try it!
Got an example for us? I'm kind of confused.
Me too....
I think he's talking about "the life simulation",
each pixel is dead or alive depending on in
wich states the eight pixels around it is...
Yeah.

You count up the number of pixels around each pixel, and then apply the rules.

Watch out for borders.

EDIT:
I just realized the topic's initial poster meant the pyramid format not the map format.
Quote:I read about a simple program that you can make in just a few minutes. It's pretty cool, so try it:

Use a screen mode w/ high res and PSET a single pixel on the top row.

Have a loop that goes through pixel by pixel. The pixel is either colored or left blank based on the binary sequence of the pixels above it. For example, you could have it go so if the 3 pixels above it were 1, 0, 1, then that it becomes on.

The 3 pixels have 2 ^ 3 = 8 combinations you need to take care of.

If you randomize the different combinations that either turn the pixel on or off, different designs are created, including some fractals.

Try it!

I wrote a program to display the 1-D automata you are talking about. It's located here:
http://www.tcdn.teiher.gr/upload/downloa...fileid=644

This program will allow the user to specify the width of the automata, and the rule used to update at each step. Thi initial condition can be changed within the code.
Quote:I read about a simple program that you can make in just a few minutes. It's pretty cool, so try it:

Use a screen mode w/ high res and PSET a single pixel on the top row.
Code:
SCREEN 11
DEFINT A-Z
CLS
PSET (320, 1)

FOR y = 2 TO 480
FOR x = 1 TO 630
  PSET (x, y), (POINT(x - 1, y - 1) XOR (POINT(x, y - 1) OR POINT(x + 1, y - 1)))
NEXT x
NEXT y

Try this...
Um... I already made the program - not asking for help. But thanks anyway. Smile

For those of you who don't know what I'm talking about, I'll try to post a few screen shots as soon as I find the time.
Heh mango try changing that OR to a XOR makes a neat triangle pattern thingy
Quote:Heh mango try changing that OR to a XOR makes a neat triangle pattern thingy

:-) Really??!!! ;-)

after a many-year break in programming, I read Wolffam's "A new kind of science" and started programming in QB...the only language I know. Here's code to allow you to explore ALL the 1D cellular automata. Just type a number for the rule...

http://www.tcdn.teiher.gr/upload/downloa...fileid=644

I was just showing how easy it was to get nice output from a small amount of code. The automata you 'discovered' by replacing xor with or is one of the "non-interesting" nesting patterns. Pattern 30 or 110, are more interesting, because they are less predictable.

Cheers!!! I'm glad you liked the pattern!...BTW...Wolfram is the guy responsible for Mathmatica software...in case anyone reading this is not up to speed on this topic...

BTW2...about your RND generator...after 500k cycles, it stops filling the screen...yet the screen is not yet filled...on my machine...do you have different results?
Pages: 1 2