Welcome to AutomaPaint! A 2D cellular automaton lab, the first ever for ComputerCraft!
Created as a spiritual successor to TangentAutomaton (a one-dimensional cellular automaton lab), AutomaPaint offers many of the same features as its predecessor! A custom starting generation, custom rules, and a re-sizable environment!
FEATURES
Spoiler
- Paint Mode
Spoiler
A.K.A: "The Canvas". A pretty generic paint program, paint mode offers an environment where users can set the starting generation for their automaton. Pixel placing is done with the left mouse button, pixel erasing is done with the right mouse button, and pixel color picking is one with the middle mouse button. using the scroll wheel scrolls through all the colors, indicated at the bottom of the screen.
To bring up the main editor menu, press the "ctrl" key. On the bottom of the editor, five buttons, "[L]
The "[T]" button, "tools", will bring up a menu containing editing tools. Currently, the only tool in there is the "line tool". To use the line tool, have the color you want to use already selected, and click on the starting point. A "1" with a background of the color you chose previously will appear in the spot. The second place that you click on will draw a line from the "1" point, to the place you clicked. WARNING: Panning while using the line tool has unpredictable results! You have been warned!
The last button, "[X]", simply stops the script, and takes you back to the terminal.
Using the arrow keys in the canvas pans you around. Panning into a place with nothing expands the canvas. Keep that in mind!
- Text Editor Mode
Spoiler
Text editor mode is a rather simplistic text editor, designed to do nothing more than edit the rules for the automatons. To leave this mode, and return to the canvas, press the "Ctrl" key. All changes you make here are automatically saved when you quit. Please take note that any "spaces" in the editor act as a "carriage return", and anything past one will not get saved! Remember, I made this editor for editing a simple CA rule system, not writing pretty attachment notes on images!
- Cellular Automaton Lab
Spoiler
The star of the show, the CA lab allows you to run the CA that you create in the other two editors. The environment is finite, so any gliders that hit the side of the world will act as if they hit a brick wall, and stop. Future version might allow you to run this mode on a monitor.
The new interface for the CA Lab can be brought up with the "Ctrl" key. On this menu, you'll see four buttons: "[#] [BACK] [BACK & SAVE] [START GENERATING]". "[#]" will bring up a (currently a bit buggy) menu that allows you to enter how many generations you want the CA to run. "[BACK]" will take you back to the canvas. "[BACK AND SAVE]" will bring up a prompt asking if you're sure you want to overwrite the canvas with the sandbox. If you hit the "Y" key on your keyboard, the canvas will be over-written with the current generation in the CA. Hitting anything else will close it, and take you back to the CA Lab. "[START GENERATING]/[STOP GENERATING]" Either turns the automatic clock on, or off. The CA will run as fast as it can with this on.
THE RULE SYSTEM
Spoiler
The rule system for the CA lab was made to be as small and efficient as possible. If you have any questions on 2D CA rules, make sure to check out the page on wikipedia.The syntax for the rule system is as follows:
A>B|X-Y,
A is the state to turn from if the conditions are met. B is the state to turn to if the conditions are met. Basically think of the ">" as an arrow. "A turns into B". "|" means "If the following condition occurs". "|" can be replaced with ":", which means "If the following condition does not occur". This is useful for rules where cells die if they're not surrounded. X is the number of cells in the states defined in Y that are required to trigger the A>B. "," is simply there as a placeholder for future symbols. If you don't include the "," at the end, the rule won't work! I'm going to change this in the next version!Examples:
Conway's game of life:
0>1|3-1,
1>0:23-1,
A cell with a state of 0 will become a cell with a state of 1 if it is surrounded by 3 neighbors with the state of 1. End.A cell with a state of 1 will become a cell with a state of 0 if it is not surrounded by 2 or 3 neighbors with the state of 1. End.
WireWorld:
1>2|0-F,
2>3|0-F,
3>3|0-F,
3>2|12-1,
New in version 1.1.1:
To use the redstone output system, have the resulting state be a "@". Depending on what side of the cell that is reciving contact, a redstone signal will be emitted. An example use of this symbol, for use in wireworld, is "4>@|1234-1". The "turn from" value is simply the state that the "sensor" will use when placed down. It will emit a redstone signal if it is surrounded by 1, 2, 3, or 4 cells with the state of 1.
The side of the computer that the redsotne will be emitted from is dependent on what side of the cell was "collided" with. Contact with the bottom of the cell will output a redstone signal on the bottom of the computer, contact with the right side of the cell with output the the right side of the computer, etc.
Sensing of what side the cell was "interacted" with is the first step towards the JvN neighborhood, which should be implemented within the next 5 versions.
CHANGE LOG
Spoiler
–V. 1.0.1:–Cleaned up the code a bit
–Updated the os.pullEvent system to the new version in Pre. 3
–Going into the CA lab now saves, and ten loads, to a local file. This helps with keeping the rule system cleaned.
–V. 1.0.5
–Cleaned up the code a bit more
–Added panning and scrolling!
–Added a better rendering system.
–Changed the save system a bit. OLD SAVES WILL NEED MODIFYING!
–Fixed a few random rendering bugs in the CA lab
–CA lab should run a bit faster
–V. 1.0.9
–Added a line tool! Woot!
–Canvas now has a "character" layer and a "color" layer, making it 3D.
–Renovated the rendering code to support the new 3D canvas
–Ctrl now hides/shows the toolbar. A bit buggy, but it works for now.
–Cleaned up some troublesome code
–Added a toolbar to the CA lab
–Allowed saving changes from the lab, to the canvas.
–WARNING: Some parts of the line tool are quite buggy, as it is still a WIP! Use at own risk!
–V. 1.1
–Cleaned up the code a bit.
–Created a new menu system.
–Added redstone output!
–Changed the ">" symbol to "}".
–Changed the "-" symbol to "/".
–fixed the weird jumpy CA Lab issue
–V. 1.1.1
– !Completely re-wrote the rules system, speeding things up greatly
– !Fixed a bug with the "back" menu.
– +Added back ">" and "-"
– +New redstone output system ("@"). Now dynamic, and much less cumbersome!
– +Added some groundwork for JvN neighborhood*
– +Added "Known bugs" section to changelog
– +Added "Next version" section to changelog
– +Added "Planned" section to changelog
– -Removed some testing code
– -Removed easter eggs
KNOWN BUGS
Spoiler
– !!Text editor will have artifacts from previous rule that was loaded– !Minor flickering in some places
– !!Line tool glitches out if you pan the canvas while using it
– !!Clicking on load, then pressing "return" with nothing entered does weird stuff
NEXT VERSION
Spoiler
– Rectangle tool– Better text editor
– Attempt to remove annoying "," character at end of rules
PLANNED FEATURES
Spoiler
–JvN neighborhood–Support for more than 16 cell states
–Redstone input
–Color selection menu
–"Will always" symbol for rule system
–"Wildcard" symbol for rule system
–More tools in tool menu
–Better save system
–Scrolling in rule editor
Download should be at the bottom of this post. Install it just like any other computercraft script! I apologize for the messy code. As development continues, so will the code's neatness. Messy code is a sign of development!
Please report all bugs in this topic!
Download: https://dl.dropbox.c...42/TangentPaint