| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
draw on terminal with python
You are to implement a terminal-based drawing programC 5 10
-------
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
-------
L 0 0 0 5 x
-------
|x |
|x |
|x |
|x |
|x |
|x |
| |
| |
| |
| |
-------
R 0 0 3 3 y
-------
|yyyy |
|y y |
|y y |
|yyyy |
|x |
|x |
| |
| |
| |
| |
-------
R 2 2 4 4 z
-------
|yyyy |
|y y |
|y zzz|
|yyzyz|
|x zzz|
|x |
| |
| |
| |
| |
-------
B 3 3 z
-------
|yyyy |
|y y |
|y zzz|
|yyzzz|
|x zzz|
|x |
| |
| |
| |
| |
-------
B 0 1 y
-------
|yyyy |
|y y |
|y zzz|
|yyzzz|
|y zzz|
|y |
| |
| |
| |
| |
------- (nothing happened)
L 0 6 4 9 d
-------
|yyyy |
|y y |
|y zzz|
|yyzzz|
|y zzz|
|y |
|d |
| dd |
| d |
| d|
------- (diagonal line, bresenham line;s algo from googling )
B 0 6 c
-------
|yyyy |
|y y |
|y zzz|
|yyzzz|
|y zzz|
|y |
|c |
| cc |
| c |
| c|
-------
Q
Quitting. (then application quit)
pip install behave # (or pip install -r requirements.txt)
behave # if you want to test all feature file
behave features/command_basic_check.feature # if you want to test a single feature filepython draw.pyconsult scenarios (.feature files) under folder features if you find any confliction and then raise an issue about this confliction
(0,0) is at the left top of the canvas, larger x means more close to right, larger y means more close to bottom, all coordinates can not be negative
you must create a canvas board before drawing anything
all coordinates cannot exceed the canvas, otherwise an error message will throw but application continue to run
for invalid command input, and error message will throw out but application continue to run
virtual z axis for rectangles and lines objects (I learnt it from computer graphic, it's called z-buffer)
Any command that specifies coordinates outside the current canvas dimensions
Any command that specifies negative coordinates
Zero-length lines or rectangles (start == end)
Bucket-fill (B x1 y1 c):
Rectangle drawing (R x1 y1 x2 y2 c) should always draw borders only; the inside remains blank until a bucket-fill command is applied.
| Back | FazBrowse Home | New Git URL |