Skip to content

MugilanGN/Flowchart-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flowchart-Generator

Automatically creates Flowcharts from Pseudocode!

Video Demo

https://www.youtube.com/watch?v=1gCqPBzU8Z0

Installing through Repl.it

If you don't want to download this or setup python, you can run this project directly from your browser with repl.it

This link will automatically clone the project and set it up for you. If you want to do it manually, you can import github.com/MugilanGN/Flowchart-Generator into repl.it yourself.

From here onwards, you can edit the enter.txt file in the repl project and replace it with your own custom pseudocode.

Once you are done, you can run the commands from the CLI Usage section of the README in the repl.it terminal.

Local Installation

This project was built on Python 3.7.4

Run this to install the necessary dependencies:

pip install Pillow==9.0.0 click

Next, clone this project onto your system.

Writing the Pseudocode

The Pseudocode is entered into a .txt file. It follows strict rules which must be obeyed

alt text

Rules

STOP and START are automatically input by the program, so do not need to be added

Indents don't affect the program, so nothing has to be indented, and incorrect indentation is allowed

The capitalization of the keywords is extremely important. If an error occurs, double check if you have capitalized the keywords like "TO" and "FOR" properly

ELSE IF is not available, but nested IFs are possible

The ENDIF, NEXT var, and ENDWHILE blocks are mandatory

Syntax Guide

Input and Output:

  • INPUT x
  • OUTPUT x
INPUT X
OUTPUT var
OUTPUT "hello"

IF statements:

  • IF condition THEN
  • ELSE
  • ENDIF
IF x < 3 THEN
  OUTPUT X
ELSE
  OUTPUT x*2
ENDIF

The else statement is optional (ENDIF is still necessary)

IF x < 3 THEN
 OUTPUT X
ENDIF

Process-type blocks:

x = x + 1
y = x / 2

While loops:

  • WHILE condition DO
  • ENDWHILE
WHILE x < 5 DO
  OUTPUT x
ENDWHILE

For loops:

  • FOR var <- start TO end
  • NEXT var
FOR i <- 1 TO 5
  OUTPUT i
NEXT i

CLI usage

To run the code, simply execute the following command:

python Converter.py

Arguments

Arguments in the CLI are typed like so: --size=20 or --code="enter.txt"

  • --size is the font size used. This controls the size of the entire flowchart as well. By default it is 20px
  • --font is the font path. A default NotoSans font is used at "./fonts/", but can be changed for different OSs or fonts
  • --output is the flowchart's image file. Default is "flowchart.png"
  • --code is the file with the pseudocode. Defaults to "enter.txt"
  • --help provides CLI help

For example:

python Converter.py --code="code.txt" --size=30 --output="result.png"

Flowchart Image

This image contains the created flowchart which can be shared, printed, etc. Its size varies exactly on the size of the flowchart created, so it may even hit a resolution of 10k pixels! However if the generated flowchart is too big, then the image will be unopenable due to being too large. The user should be careful with flowchart sizes.

Support

If you are having issues, please let me know. You can contact me at mugi.ganesan@gmail.com

Releases

No releases published

Packages

No packages published

Languages