Skip to content

[12] Generator: Utilities#14

Merged
phillpeters merged 6 commits intomainfrom
12-generator/utility
Aug 5, 2022
Merged

[12] Generator: Utilities#14
phillpeters merged 6 commits intomainfrom
12-generator/utility

Conversation

@Thenlie
Copy link
Copy Markdown
Owner

@Thenlie Thenlie commented Aug 5, 2022

Utility directory created ✅

A utility directory has been created with arrayUtil and mazeUtil files. These files contain functions that generically work on 2D arrays and the HTML maze respectively. All future files that works on these parts of the program in a generic sense should be added to these files.

NOTE: If you have suggestions for improvements, let @Thenlie know. ⚠️ Otherwise please do not change the existing functions as they impact the maze generation.

Closes #12

Functions

create2dArray(x, y):

This function takes a length (x) and width (y) parameter and returns a 2D array of that length and width.

checkPosition(arr2D, x, y):

This function takes a 2D array (arr2D), length (x) and width (y) parameter and returns the value of arr2D[x][y].

clearMaze():

This function clears the background colors from the HTML maze.

NOTE: This can be updated to also remove textContent if needed

@Thenlie Thenlie added type: enhancement Additions to existing code type: refactor Update of existing code labels Aug 5, 2022
@Thenlie Thenlie added this to the Maze Generation Component milestone Aug 5, 2022
@Thenlie Thenlie requested a review from phillpeters August 5, 2022 01:20
@Thenlie Thenlie self-assigned this Aug 5, 2022
@Thenlie Thenlie linked an issue Aug 5, 2022 that may be closed by this pull request
4 tasks
Copy link
Copy Markdown
Collaborator

@phillpeters phillpeters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful! Really cleans things up.

@phillpeters phillpeters merged commit 9a6b96b into main Aug 5, 2022
@phillpeters phillpeters deleted the 12-generator/utility branch August 5, 2022 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement Additions to existing code type: refactor Update of existing code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create utility file

2 participants