Skip to content

nmanoogian/PixelifeJava

Repository files navigation

Pixelife Java

A Pixel simulator written with Java's Graphics2D libraries
  • Pixels are representated by objects called Pix
  • There are different kinds of Pix objects, each with their own attributes
  • Pix objects interact with each other, growing and shrinking in their environment

The basic Pix object follows these rules:

  • Each Pix object has red, green, and blue values ranging from 0 to 255. These values are called channels
  • Usually, Pix objects are generated with three random channels such that no two channels are the same
  • When it is a Pix object's turn to move, it chooses a random direction: north, south, east, or west
    • If the space is empty, the Pix is duplicated to this location
    • If the space occupied, the two objects interact
  • If two Pixels have the same highest channel, then they are said to have the same dominant channel
  • If two Pixels have the same dominant channel and they interact, both increase that channel by 2 points and both decrease each of the non-dominant channels by 1
  • If two Pixels interact, but do not have the same dominant channel, they both remain unchanged

To observe different Pix objects and their interactions, add a Spawner or modify the default in the Pixelife class:

spawner = new Spawner(AgingPix.class, myGrid);
spawner.spawn(100);

To compile and run:

javac *.java && java Pixelife

Or simply:

make life

A few of the more notable classes:

  • RainbowPix - Generates a rainbow pattern
  • PulsePix - Pulses from the center
  • AgingPix - Pixels "grow old" and become white
  • SpiralPix - Forms a spiral pattern
  • WallPix - Multiple form a maze pattern which contains Pix growth
  • ScaredPix - Recedes away from other Pix
  • ConformingPix - Change to the color of the Pix around them (causes blurring)
  • AvgPix - Change to the color of the average of the current color and the color of the interacting Pix

About

Pixel fighting arena written in Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages