main
cos125-project2 Project Design Review
Data:
Required modules: graphics.py, config.py
Variables
| Type | Data Type | Name | Scope | Description | Default Value |
|---|---|---|---|---|---|
| CONSTANT | str | PRESET_NAME | Global* | Name of preset to be loaded | |
| CONSTANT | bool | VERBOSE_MODE | Global* | Enables or disables verbose logging to console | False |
| CONSTANT | int | WINDOW_WIDTH | Global* | Width of the window for the display (in pixels) | 600 |
| CONSTANT | int | WINDOW_HEIGHT | Global* | Height of the window for the display (in pixels) | 600 |
| CONSTANT | int | LOWER_SPLIT_BOUND | Global* | Minimum width and height of all rectangles | 90 |
| CONSTANT | float | REGION_MULTIPLIER | Global* | Value to multiply region size by to determine random split | 1.5 |
| CONSTANT | int | SPLIT_POINT_LOWER_PERCENTAGE | Global* | Lower percentage of split point position in region | 38 |
| CONSTANT | int | SPLIT_POINT_UPPER_PERCENTAGE | Global* | Upper percentage of split point position in region | 38 |
| CONSTANT | float | COLOR1_CUTOFF | Global* | Cutoff for COLOR1 in fillRegion() | 0.9 |
| CONSTANT | str | COLOR1_COLOR | Global* | Color for COLOR1 used for fill | yellow |
| CONSTANT | float | COLOR2_CUTOFF | Global* | Cutoff for COLOR2 in fillRegion() | 0.15 |
| CONSTANT | str | COLOR2_COLOR | Global* | Color for COLOR2 used for fill | blue |
| CONSTANT | float | COLOR3_CUTOFF | Global* | Cutoff for COLOR3 in fillRegion() | 0.25 |
| CONSTANT | str | COLOR3_COLOR | Global* | Color for COLOR3 used for fill | red |
| CONSTANT | int | REGION_WIDTH_LOWER | Global | Denotes lower width bound of current_bounds[list] index value |
0 |
| CONSTANT | int | REGION_WIDTH_UPPER | Global | Denotes upper width bound of current_bounds[list] index value |
2 |
| CONSTANT | int | REGION_HEIGHT_LOWER | Global | Denotes lower height bound of current_bounds[list] index value |
1 |
| CONSTANT | int | REGION_HEIGHT_UPPER | Global | Denotes upper height bound of current_bounds[list] index value |
3 |
| VARIABLE | GraphWin | draw_window | Passed to all | GraphWin variable to dynamically add additional rectangles as generated | |
| VARIABLE | list** | current_bounds | Local | Contains current bounds of loaded region | |
| VARIABLE | int | region_width | Local | Contains width of loaded region | |
| VARIABLE | int | region_height | Local | Contains height of loaded region | |
| VARIABLE | int | r | Local | Temporary random number storage variable | |
| VARIBALE | int | random_split_point_multiplier | Local | Percentage of region width or height to add to the lower bound to create the new split | |
| VARIABLE | int | random_split_point_multiplier | Local | Calculated point in x or y plane to split new region | |
| VARIABLE | list** | bound1 | Local | New region created from split | |
| VARIABLE | list** | bound2 | Local | New region created from split | |
| VARIABLE | Rectangle() | temp_rect | Local | Temporary Rectangle() to be added to draw_window[GraphWin] |
|
| VARIABLE | str | fill_color | Local | String of color of temp_rect[Rectangle()] to be added to draw_window[GraphWin] |
* Denotes configurable setting in config.py
** See below for specifics on data structure
| Index | Type | Description | Access Variable |
|---|---|---|---|
| 0 | int | Denotes lower width bound | REGION_WIDTH_LOWER |
| 1 | int | Denotes upper width bound | REGION_WIDTH_UPPER |
| 2 | int | Denotes lower height bound | REGION_HEIGHT_LOWER |
| 3 | int | Denotes upper height bound | REGION_HEIGHT_UPPER |
Algorithms / Functions
| Name | Parameters | Description | Calls |
|---|---|---|---|
| main() | None | Primary Program Control and Execution | canvasSplit() |
| canvasSplitLogic() | current_bounds[list], draw_window[GraphWin] |
Logic for splitting the canvas into rectangles | splitCurrentBoundWidth(), splitCurrentBoundHeight(), fillRegion() |
| splitCurrentBoundWidth() | current_bounds[list], draw_window[GraphWin] |
Splits width of current bounds into two new sections | fillRegion(), canvasSplitLogic() |
| splitCurrentBoundHeight() | current_bounds[list], draw_window[GraphWin] |
Splits height of current bounds into two new sections | fillRegion(), canvasSplitLogic() |
| fillRegion() | current_bounds[list], draw_window[GraphWin] |
Fills region and determines color using internal logic | None |
Program Pseudocode
Function Execution Order
main()
| /------------------------------------------------------------------------------------\
| / |
| / /-----> splitCurrentBoundWidth() ----------\ |
| / / \ |
canvasSplitLogic() ----- ----------\ /--------------|
| \ / | ↓
| \-----> splitCurrentBoundHeight() ---------/ | fillRegion()
| |
\------------------------------------------------------------------------/
Description
Releases
2
COS125 v.1.1 Release
Latest
Languages
Python
99.5%
HTML
0.5%