GridScorer takes in a linear array and turns into an n matrix; based on the input it will calculate the highest score from itself and the surrounding location. This will then return a string result with the following format (x, y, total value)
Example array: [4,2,3,2,0,1,2,2,1,3,0,2,2,0,1,5]
Example matrix from the above array:
4 | 2 | 3 | 2
0 | 1 | 2 | 2
1 | 3 | 0 | 2
2 | 0 | 1 | 5
Example of input:
count_of_high_scores = 2
row_length = 4
array = [4,2,3,2,0,1,2,2,1,3,0,2,2,0,1,5]
Example of output:
(1, 2, 17)(1, 1, 16)
Make sure to have rustup installed - https://www.rust-lang.org/tools/install
You can use your IDE of your choice, but I will provide the setup for Visual Studio Code:
- Install the "rust-analyzer" extension (this aids with development and the ability to build the project)
- Using the shortcut ctrl + shift + B, you will get the option to build, check or run clippy (conforming to the standard style of Rust) against the project
- Install "CodeLLDB" this will help running tests locally
To build the project, in terminal run the follwing command:
cargo build
To test the project, in terminal run the follwing command:
cargo test
You can also run tests within thet test file; either all test from the top of the class or for each individual test (You MUST have CodeLLB installed for this)