Code visualizer
Bombs position
0 | 1 | 2 | |
---|---|---|---|
0 | 1 | 0 | 1 |
1 | 0 | 1 | 0 |
2 | 1 | 0 | 1 |
Map layout
0 | 1 | 2 | |
---|---|---|---|
0 | 0 | 0 | 0 |
1 | 0 | 0 | 0 |
2 | 0 | 0 | 0 |
Code visualizer
Code visualizer improve algorithms and data structures understanding with visualization of data structures with minimum change to the code. Write an algorithm, add some lines of code and you're ready to go.
Code visualizer is an open source project, anyone can contribute writing an algorithm, fixing bugs or improving the application, you just need a github account.
How it works
There are three main aspects in code visulizer, the Algorithm canvas, the Strutures and the Selections.
The algorithm canvas is an object that is in charge to draw content on the visualizer, i will recibe a structure and watch for changes.
There are multiple data structures in code visualizer, first we have the array in one dimension or two dimensions, to create an structure you just need to create a new instance of the requested class, then you give it an inivial value and a name.
When you are done writing your code and drawing to the canvas you can build it to visualizer in the visualizator, just click on the wrench icon to build it, if everything goes correctly you will see your structures in the visualizator.
In the top part you will see the controls, how many steps you code generated and modify the speed that it's reproduced
How it works
0 | 1 | 2 | |
---|---|---|---|
0 | 1 | 2 | 3 |
Selections
Visualizing data structure is not enough to undertand what an algorithm is doing, to improve the experience you can select some elements in the data structure, for example lets say that you want to iterate through each one of the elements on the array and show to the user where you are in determinated step, you can highligt the elements with the select method on the structure.
Here is an example.
Selections
0 | 1 | 2 | 3 | |
---|---|---|---|---|
0 | 1 | 2 | 3 | 4 |
If you didn't notice the selection have a default style, wich is a lighter background, but if you want multiple selections with different colors you need something more advaned, you can pass as second argument the background color of the element and as third argument the color of the font.
This code iterate through the array and then select the highest among all with red and the the minimum with blue.