Today I completed addition and subtraction. I also included a multiplication function. All combinations of positives, negatives, and zero are supported. Leading zeros are removed, and there is no such thing as negative zero. The multiplication algorithm is pretty naive and what one would learn in grade school. I didn’t think the integers would be big enough to require more sophisticated algorithms. They are big-enough integers. Maybe at a later time.
Next up, division and modulus. Check it out.
Wireworld is another neat kind of cellular automaton, invented in 1987 by Brian Silverman. It simulates circuitry; by implementing a series of logic gates, you can create a rudimentary computer. This makes the system Turing-complete.
Click on the grid squares to set their values: gold for wire, blue for the head of an electron, red for its tail, or black for empty. Use it to construct a variety of circuits.
A belated entry for Day 6, this is an HTML5 version of the game Core War. Two players try to take control of a computer by programming warrior bots in a special language called Redcode. Many of the major instructions have been implemented here, including DAT, MOV, ADD, and JMP. Instruction modes are direct, indirect, and immediate. When the machine runs, you can see the bots chase each other throughout the computer’s memory.
Grab the code here.