Skip to content

RobertNagy299/DragonCurveVisualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

C - Dragon curve visualizer (NOT MEMORY SAFE)

Description

I made this project during my first semester at my university - with very limited knowledge - in order to respond to an older student's challenge.

The project consists of a simple C program that uses the paint.h and gfx.h header files provided by my university and my personal implementation of linked lists. The program starts drawing the dragon fractal on the terminal. The number of iterations can be changed in the source code.

Languages and Utilities Used

  • C
  • paint.h file
  • paint.c file
  • gfx.h file
  • gfx.c file

Environments Used

  • Debian 12 (Linux)
  • Visual Studio Code
  • Oracle VM Virtualbox

Program walk-through:

Open the folder in Visual Studio Code (make sure that all of the files are in the same folder), open a new terminal, and enter the following command to compile the code:

gcc fractal.c paint.c gfx.c -lX11 -lm -o program -Wall 
Note: "program" is just an arbitrary name I chose for the compiled file, you can change it to whatever you want it to be. Just make sure that when you run the code using ./program, you run it with your own file name instead, like this: ./yourfilename

Linux command to compile fractal.c



Final picture after 10 minutes of runtime with size = 4

Final picture of the dragon fractal



Valgrind error messages:

Valgrind error messages on the terminal screen

Conclusion and final comments

I am rather disappointed by the fact that my code is so inefficient and unsafe. However, it is worth nothing that this project was more of a proof-of-concept, a challenge by an older student.

Possible issues / ideas for improvement: Perhaps I should change the function return types to 'void', and use a node_t** type as an argument, in order to avoid unneccessarily copying nodes in the memory. I also fail to free the allocated memory at a number of instances.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages