summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--day11/src/main.rs19
1 files changed, 8 insertions, 11 deletions
diff --git a/day11/src/main.rs b/day11/src/main.rs
index c632acf..37e1a00 100644
--- a/day11/src/main.rs
+++ b/day11/src/main.rs
@@ -1,13 +1,12 @@
static INPUT: i32 = 9005;
-static WIDTH: usize = 300;
-static HEIGHT: usize = 300;
+static SIZE: usize = 300;
type Grid = Vec<Vec<i32>>;
fn build_grid() -> Grid {
- let mut grid = vec![vec![0; WIDTH]; HEIGHT];
- for y in 1..HEIGHT + 1 {
- for x in 1..WIDTH + 1 {
+ let mut grid = vec![vec![0; SIZE]; SIZE];
+ for y in 1..SIZE + 1 {
+ for x in 1..SIZE + 1 {
if y == 5 && x == 3 {
print!("");
}
@@ -54,13 +53,11 @@ fn main() {
// visualize(&grid);
let mut max_sum = std::i32::MIN;
- let mut mx: usize = 0;
- let mut my: usize = 0;
- let mut msize: usize = 0;
- for s in 1..301 {
+ let (mut mx, mut my, mut msize): (usize, usize, usize) = (0, 0, 0);
+ for s in 1..SIZE + 1 {
println!("Debug: Running for size = {}", s);
- for y in 0..HEIGHT - s + 1 {
- for x in 0..WIDTH - s + 1 {
+ for y in 0..SIZE - s + 1 {
+ for x in 0..SIZE - s + 1 {
let sum = sum_subsquare(&grid, (x, y), s);
if sum > max_sum {
max_sum = sum;