Version 5 of Creating a World

Updated 2010-08-06 18:21:50 by gold

George Peter Staplin: Nov 2005 - Have you ever pondered the possible combinations of an area in the world? I was staring at something once upon a time and I realized that if I represented each part of the image I saw with pixels I could view every possible image that might ever happen in that area.

Imagine that we start with darkness. We add one pixel of color at 0,0. We then change to the next color for 0,0. If we continue creating every possible combination of color for every pixel combination we will have created every possible image for that area. In theory a man should be able to watch his birth, marriage, and death all within the area of this image. In fact every possible shape and situation could be simulated this way (for that area). We end with pure light. I've pondered that perhaps this is why light is associated with knowledge.

Now I can't claim to have seen all of this. This is just an idea that I completely lack the computing power for. There is also the problem of sifting through the garbage to find the useful and interesting images.

This is a simple example to get you started with the ideas behind it. This manipulates a small area to create black and white patterns.


 #
 # Create a World
 #
 # By George Peter Staplin
 #
 package require Tk

 if 0 {
  1 0 0 0 0 0 0 0 0 0
  0 1 0 0 0 0 0 0 0 0
  0 0 1 0 0 0 0 0 0 0
  0 0 0 1 0 0 0 0 0 0
  0 0 0 0 1 0 0 0 0 0
  0 0 0 0 0 1 0 0 0 0
  0 0 0 0 0 0 1 0 0 0
  0 0 0 0 0 0 0 1 0 0
  0 0 0 0 0 0 0 0 1 0
  0 0 0 0 0 0 0 0 0 1
  1 1 0 0 0 0 0 0 0 0
  1 0 1 0 0 0 0 0 0 0
  1 0 0 1 0 0 0 0 0 0
  1 0 0 0 1 0 0 0 0 0
  1 0 0 0 0 1 0 0 0 0
  1 0 0 0 0 0 1 0 0 0
  1 0 0 0 0 0 0 1 0 0
  1 0 0 0 0 0 0 0 1 0
  1 0 0 0 0 0 0 0 0 1
  0 1 1 0 0 0 0 0 0 0
  0 1 0 1 0 0 0 0 0 0
  0 1 0 0 1 0 0 0 0 0 
  0 1 0 0 0 1 0 0 0 0
  ...
 }

 proc zoom.image {img xratio yratio} {
  set result [image create photo]
  $result copy $img -zoom $xratio $yratio
  return $result
 }

 proc init.array size {
  for {set i 0} {$i < $size} {incr i} {
   #
   # Initialize all points to a value that results in no display.
   #
   set ::points($i) -1
  }
 }

 proc generate.image {img size} {
  $img blank

  set cursor 0

  while 1 {
   incr ::points($cursor)
   if {$::points($cursor) >= $size} {
    set ::points($cursor) 0
    incr cursor
   } else {
    break
   }
  }

  for {set p 0} {$p < $size} {incr p} {
   if {$::points($p) < 0} {
    break
   }
   set y [expr {$::points($p) / [$img cget -width]}]
   set x [expr {$::points($p) % [$img cget -width]}]

   $img put "#ffffff" -to $x $y
  }
 }

 proc do.generation {img size} {
  set last [expr {$size - 1}]

  if {$::points($last) > [$img cget -width]} {
   return
  }

  generate.image $img $size

  set old [.l cget -image]

  if {"" ne $old} {
   image delete $old
  }

  .l config -image [zoom.image $img 10 10]

  after 1 [list do.generation $img $size]
 }

 proc main {} {

  set width  5
  set height 5

  . config -bg black

  set img [image create photo -width $width -height $height]

  set size [expr {$width * $height}]
  init.array $size

  pack [label .l -bg black -fg white] -fill both -expand 1

  do.generation $img $size
 }
 main


Screenshots Section

http://farm5.static.flickr.com/4097/4866124659_9d2d2ef9fb.jpg

gold added pix


Category Animation - Category Toys