package main

import (
	"fmt"

	h "git.bullercodeworks.com/brian/adventofcode/helpers"
)

func main() {
	inp := h.StdinToIntSlice()
	fmt.Println("# Part 1")
	part1(inp)
	fmt.Println("# Part 2")
	part2(inp)
}

func part1(input []int) {
	var inc int
	for i := 1; i < len(input); i++ {
		if input[i] > input[i-1] {
			inc++
		}
	}
	fmt.Printf("%d measurements increased\n", inc)
}

func part2(input []int) {
	var inc int
	for i := 1; i < len(input); i++ {
		if i < len(input)-2 {
			a := input[i-1] + input[i] + input[i+1]
			b := input[i] + input[i+1] + input[i+2]
			if b > a {
				inc++
			}
		}
	}
	fmt.Printf("%d measurement windows increased\n", inc)
}
