Home    Research    Teaching    Others    Experiments
Licencia de Creative Commons
Experiments by David Orellana Martín is licensed under a Creative Commons Reconocimiento 4.0 Internacional License.

If you have any doubt on how to use any of these tools, please do not hesitate to write me an email.

Cellular automata


1d rule: 2d rule:

QR Code automatically generated via Nayuki QR Code generator TS library, transformation to canvas by me. Here, both 1d and 2d cellular automata can be simulated. While clicking one of the "Restart" buttons, it loads the corresponding rule (take into account that the rule cannot change through the computation). For more information about elementary (1d) cellular automata, go to WolframAlpha website, and for more information about Birth/Survive rules, go to Wikipedia. When clicking "Compute!", the computation starts until a button is pressed. The computation can be done step by step by clicking the cellular automaton itself.

Sorting algorithms


A visual representation on how different sorting algorithms work is depicted here. It is really simple to use, the computation can be started and stopped with the "Sort!"/"Stop" button, and the numbers can be shuffled with the "Restart" button. The computation can be done step by step by clicking the image itself. The colors depicted here represent numbers from 0 to 49, where the "bluest" one represents the 0, while the "redest" one represents the 49. By now, the following algorithms are implemented (in this order) here (but more are to be implemented): The messy code has an explanation: In order to be able to show a step-by-step evolution, recursive code has been transformed into iterative code.

k-means clustering


# points = # clusters = # centroids =

A simulation of the k-means clustering algorithm is depicted here. With the "Compute!"/"Stop" button, the algorithm can be run and stopped. The computation can be done step by step by clicking the image itself. There are two different "Restart" buttons here. On the one hand, "Restart (random)" creates #points points distributed in a random way through the whole picture, and the number of centroids is #centroids. On the other hand, "Restart (n clusters)", #points points are created, but this time distributed in some kind of pseudo-clusters (distributed in #clusters 2d-spheres), and the number of centroids is #centroids.

GOTO simulator
Input variables

GOTO program

Program code
Computation


The GOTO simulator is intended to simulate the GOTO model of computation. For a deep introduction to this model, goto (pun intended) Models of Computation and Complexity course website (in Spanish) or [1]. The basic ingredients of this model are the following: Variables (V):
  • Output variable: Y
  • Input variables: X{1} (= X), X{2}, ...
  • Auxiliary variables: Z{1} (= Z), Z{2}, ...
Labels (L):
  • A{1} (= A), A{2}, ...
  • B{1} (= B), B{2}, ...
  • C{1} (= C), C{2}, ...
  • D{1} (= D), D{2}, ...
  • E{1} (= E), E{2}, ...
Instructions:
  • Increment: V <-- V + 1
  • Decrement: V <-- V - 1
  • Skip: V <-- V
  • Conditional: IF V /= 0 GOTO L
An instruction can be left-labelled writing [L] at the left side of the instruction.
In the "Input variables" text area, the value of X{1}, X{2}, ... can be written separated by a comma (,).
In the "GOTO program" text area, the instructions of a program can be written in a line each instruction.
In the "Program code" text area, the codes of the instructions can be written separated by a comma (,).
In the "Computation" text area, the computation of the program is represented.
While clicking the "Load program" button, both the input variables and the program are loaded, the program code is updated, and the initial configuration appears in the "Computation" area.
While clicking the "Load codes" button, both the input variables and the codes are loaded, the program instruction are updated, and the initial configuration appears in the "Computation" area.
While clicking the "Run step" button, a computation step is simulated, and the next configuration appears in the "Computation" area. If the current configuration is a halting configuration, then a message appears in the "Computation" area. If the message appears in the "Computation" area and the button is clicked again, nothing happens
While clicking the "Run computation" button, the system starts to simulate the computation of the program, updating the "Computation" area with the corresponding conigurations. The program can stop either if the "Stop computation" is clicked or if the simulations reachs a halting configuration. If a halting configuration is reached, and the "Run computation" button is clicked again, then the following happens: The input variables are loaded again (so the program can be used to run computations with different inputs), and if the "Program code" is different from the previous codes, then it is loaded again, otherwise the "GOTO program" is loaded.

[1] M. Davis, R. Sigal, E.J. Weyuker. Computability, Complexity and Languages. Fundamentals of Theoretical Computer Science. Academic Press, 1994.

PDP systems simulator
Membrane structure

Multisets of objects

Rules of the system
Selected rules




BBB simulator is working! But still testing... It returns the selected rules and the number of times they can be applied.
DNDP and DCBA will be released soon!

Chaos game

N = Ratio =

The Chaos Game is a 0-player game where an n-vertex polygon is situated in a 2-dimensional plane, and a point is thrown in an arbitrary place of the plane. From that point, in each step, we calculate that is in the line from the current point to a randomly selected vertex of the polygon. In fact, it is not an arbitrary point of that line, but it is exactly situated taking into account the ratio; that is, if the ratio is 1/2, then the new current point will be situated in the middle point of the segment that goes from the current point to the randomly selected vertex. Some interesting figures can be obtained by trying different values, try it! In fact, with the default arguments (N = 3, ratio = 1/2), a well-known fractal is obtained. Some proofs on why this works in this way (and a simulator that works better than this one) can be found in https://arun.chagantys.org/technical/2020/04/28/chaos-game.html.