The purpose of this project is to transform any source code into an stylized picture.
Here's a few example of file transformed by our project:
An advantage of this project, is to detect code plagiarism in the output pictures. Here's an example :
These are all students source code for a same exercice. Do you see, how, some of these are alike ?
So, our project take every files and folder in the Input folder and it'll transform every file in it into an image in the Output folder.
A file is parsed in order to generated an image. We take the text and replace all non-alphanumerics character by a space. In order to avoid noise in the output file, we delete all commentaries present in the code with a generic class that can be personnalized. For now, we delete commentaries for a few different langages, the list can be found and improved here.
Now, we count the occurence of every words of the file and order them by order of apparition.
To draw the picture, we use a multi agent system. The "Particule" agent will move and put their color on the background agent. A Background agent represent a pixel of the generated picture.
The agent are placed depending of the words found in the input file. The color is determined by the Hash of the word. And the number of agent for a specified word is determined by the number of occurence of this particular word. The more a word appear, the more his vector will be large and will last longer in the generated picture.
The main can be launched in two different mode :
- Default mode, which generate a beautiful picture of your code present in the Input file.
- Visual mode, which does the same, but you can see how it's generated. Here's an example :
This project has been written by Lucas Delvallet and Florian Doublet.