Browse Source

Adding README

dyurk 1 year ago
parent
commit
318386bcef
1 changed files with 16 additions and 0 deletions
  1. 16 0
      README.md

+ 16 - 0
README.md

@@ -0,0 +1,16 @@
1
+# DrawT00L
2
+An ASCII drawing tool that supports bucket fill.
3
+
4
+
5
+DrawT00L creates drawings by coordinates from a provided input file. drawT00L.rb takes two arguments, path to input file and path to the output file. Before starting to "draw", the program checks that two arguments are provided (input/output files), it also guards against running without providing arguments. 
6
+
7
+### There are four core methods: 
8
+**canvas** which takes two parameters (width / height). It will update the @paper array with the top, bottom and side borders, while filling each empty place of the canvas with a space.
9
+
10
+**create_line** which handles the creation of vertical and horizontal lines. The method checks for matching x and y pairs to determined the location and type of the line. Between the starting and end location, each placement is replaced with "x".
11
+
12
+**create_rectangle** makes use of the create_line method to build all 4 sides of the rectangle. 
13
+
14
+**bucket_fill** grabs the character found in the supplied coordinates to match against its surroundings.  An empty array (area_fill) is used to start checking for all candidates to be filled. As coordinates are checked they are removed from the area_fill array. On each while loop, surrounding coordinates are updated in the array covering all directions: top , bottom , left ,right. 
15
+
16
+The read_input is a simple method to handle reading each line to gather instructions. The write_output method writes to the output file on each instruction. Everything is executed inside a begin block, this allows clean handling of exceptions.