aoc2020

package
v0.0.0-...-f50ab9b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ACTIVE = "#"
View Source
const DAY_16_INPUT_1 = `` /* 19999-byte string literal not displayed */
View Source
const DAY_16_INPUT_1_TEST_DATA = `` /* 126-byte string literal not displayed */
View Source
const DAY_16_INPUT_2_TEST_DATA = `class: 0-1 or 4-19
row: 0-5 or 8-19
seat: 0-13 or 16-19

your ticket:
11,12,13

nearby tickets:
3,9,18
15,1,5
5,14,9`
View Source
const DAY_17_INPUT = `.#.####.
.#...##.
..###.##
#..#.#.#
#..#....
#.####..
##.##..#
#.#.#..#`
View Source
const DAY_17_TEST_INPUT = `.#.
..#
###`
View Source
const DAY_18_INPUT = `` /* 19585-byte string literal not displayed */
View Source
const DAY_19_INPUT_PART_1 = `` /* 18441-byte string literal not displayed */
View Source
const DAY_19_INPUT_PART_2 = `` /* 18463-byte string literal not displayed */
View Source
const DAY_1_DATA = `` /* 988-byte string literal not displayed */
View Source
const DAY_20_DATA = `` /* 17567-byte string literal not displayed */
View Source
const DAY_20_IMAGE = `` /* 9320-byte string literal not displayed */
View Source
const DAY_20_NESSIE_REGEX_LINE1 = `(..................)#(.)`

20 wide

View Source
const DAY_20_NESSIE_REGEX_LINE2 = `#(....)##(....)##(....)###`
View Source
const DAY_20_NESSIE_REGEX_LINE3 = `(.)#(..)#(..)#(..)#(..)#(..)#`
View Source
const DAY_20_TEST_DATA = `` /* 1097-byte string literal not displayed */
View Source
const DAY_21_DATA = `` /* 11752-byte string literal not displayed */
View Source
const DAY_21_TEST_DATA = `` /* 151-byte string literal not displayed */
View Source
const DAY_22_DATA = `` /* 161-byte string literal not displayed */
View Source
const DAY_22_PART_2_EXAMPLE_17_ROUND_GAME = `` /* 5075-byte string literal not displayed */
View Source
const DAY_22_PART_2_INFINITE_LOOP_GAME_DATA = `Player 1:
43
19

Player 2:
2
29
14`
View Source
const DAY_22_TEST_DATA = `Player 1:
9
2
6
3
1

Player 2:
5
8
4
7
10`
View Source
const DAY_24_INPUT = `` /* 18828-byte string literal not displayed */
View Source
const DAY_25_CARD_PUBLIC_KEY = 335121
View Source
const DAY_25_DIVIDE_BY = 20201227
View Source
const DAY_25_DOOR_PUBLIC_KEY = 363891
View Source
const DAY_25_TEST_CARD_LOOP_SIZE = 8
View Source
const DAY_25_TEST_CARD_PUBLIC_KEY = 5764801
View Source
const DAY_25_TEST_CARD_SUBJECT_NUMBER = 7
View Source
const EMPTY = 1 // L
View Source
const FLOOR = 2 // .
View Source
const INACTIVE = "."
View Source
const NONE = -1 // ?
View Source
const OCCUPIED = 0 // #

Variables

This section is empty.

Functions

func AOC_2020_01

func AOC_2020_01(cli *cli.CLI)

AOC_2020_01 is the entrypoint to the various attempts for day one

func AOC_2020_01_part1_attempt1

func AOC_2020_01_part1_attempt1(cli *cli.CLI, logger *goutils.Logger)

AOC_2020_01_part1_attempt1 this is part 1 of day 1, attempt 1 a brute-force attempt which as the volume is small works fine we have an inner loop giving o(n^2) which again works but is not fast

func AOC_2020_01_part1_attempt2

func AOC_2020_01_part1_attempt2(cli *cli.CLI, logger *goutils.Logger)

AOC_2020_01_part1_attempt2 in this atempt I preload an "inty" map affording go's own probably binsearch by keying on the int value itself this uses more memory (the inty map in addition to the list) but avoids an initial sort and binsearch I intend to do my own sort and binsearch as an attempt3

func AOC_2020_01_part2_attempt1

func AOC_2020_01_part2_attempt1(cli *cli.CLI, logger *goutils.Logger)

AOC_2020_01_part2_attempt1 the second part of day 1, attempt1 this is a brute-force attempt that gets over the line in the spirit of make it work, make it fast, this is make it work so this is 3 inner loops, giving o(n^3) performance I believe - it works, it is not fast.

func AOC_2020_02

func AOC_2020_02(cli *cli.CLI)

AOC_2020_02 is the entrypoint to the various attempts for day two

func AOC_2020_02_part1_attempt1

func AOC_2020_02_part1_attempt1(cli *cli.CLI, verbose bool)

AOC_2020_01_part1_attempt1 this is part 1 of day 1, attempt 1 a brute-force attempt which as the volume is small works fine we have an inner loop giving o(n^2) which again works but is not fast

func AOC_2020_02_part2_attempt1

func AOC_2020_02_part2_attempt1(cli *cli.CLI, verbose bool)

func AOC_2020_03_part1_attempt1

func AOC_2020_03_part1_attempt1(cli *cli.CLI, verbose bool)

AOC_2020_01_part3_attempt1 this is part 1 of day 3, attempt 1

func AOC_2020_03_part1_attempt2

func AOC_2020_03_part1_attempt2(cli *cli.CLI, verbose bool)

func AOC_2020_04_part1_attempt1

func AOC_2020_04_part1_attempt1(app *Application)

func AOC_2020_04_part2_attempt1

func AOC_2020_04_part2_attempt1(app *Application)

func AOC_2020_06_part1_attempt1

func AOC_2020_06_part1_attempt1(app *Application)

func AOC_2020_06_part2_attempt1

func AOC_2020_06_part2_attempt1(app *Application)

func AOC_2020_07_part1_attempt1

func AOC_2020_07_part1_attempt1(app *Application)

func AOC_2020_07_part2_attempt1

func AOC_2020_07_part2_attempt1(app *Application)

func AOC_2020_08_part1_attempt1

func AOC_2020_08_part1_attempt1(app *Application)

func AOC_2020_08_part2_attempt1

func AOC_2020_08_part2_attempt1(app *Application)

func AOC_2020_09_part1_attempt1

func AOC_2020_09_part1_attempt1(app *Application)

func AOC_2020_09_part2_attempt1

func AOC_2020_09_part2_attempt1(app *Application)

func AOC_2020_10_part1_attempt1

func AOC_2020_10_part1_attempt1(ints []int) map[int]int

func AOC_2020_10_part1_attempt1_from_cli

func AOC_2020_10_part1_attempt1_from_cli(app *Application)

func AOC_2020_10_part2_attempt2

func AOC_2020_10_part2_attempt2(app *Application)

func AOC_2020_13_part1_attempt1

func AOC_2020_13_part1_attempt1(cli *cli.CLI)

func AOC_2020_13_part2_attempt1

func AOC_2020_13_part2_attempt1(cli *cli.CLI)

func AOC_2020_19_part1_attempt1

func AOC_2020_19_part1_attempt1(cli *cli.CLI)

func AOC_2020_22_part2_attempt1

func AOC_2020_22_part2_attempt1(cli *cli.CLI)

func AOC_2020_24_part1_attempt1

func AOC_2020_24_part1_attempt1(cli *cli.CLI)

func AOC_2020_24_part2_attempt1

func AOC_2020_24_part2_attempt1(cli *cli.CLI)

func AOC_2020_25_part2_attempt1

func AOC_2020_25_part2_attempt1(cli *cli.CLI)

func CheckGroupAnwsers

func CheckGroupAnwsers(groupSize int, answers map[string]int) int

func Day13Logic

func Day13Logic(time int, buses []int) (int, int)

func DebugLine

func DebugLine(currentCup int, data []int) string

func DebugMatrix

func DebugMatrix(matrix map[string]*Tile, showPositions bool) string

func FindLoopSize

func FindLoopSize(subject_number int, target int) int

Finds the loop size or breaks after CIRCUIT_BREAKER times (1000)

func FindPrivateKey

func FindPrivateKey(subject_number int, max_loop_size int) int

func FlipMatrixVertical

func FlipMatrixVertical(input map[string]*Tile) map[string]*Tile

Rotates the tile 90 degrees clockwise, removing any relationships this tile has

func IndexOf

func IndexOf(value int, data []int) int

func NewGameHand

func NewGameHand(player1 *Player, player2 *Player) string

func NextInDay15Part1Sequence

func NextInDay15Part1Sequence(sequence string, iterations int) int

func NormaliseTileMap

func NormaliseTileMap(source map[string]*Tile) map[string]*Tile

func ParseDay13FilePart1

func ParseDay13FilePart1(filename string) (int, []int)

func ParseDay13FilePart2

func ParseDay13FilePart2(filename string) ([]int, []int)

ParseDay13FilePart2 returns two []int - one of the buses one of their indexes

func PlayRecursive

func PlayRecursive(player1 *Player, player2 *Player, gameNumber int) bool

func Regex

func Regex(value string, pattern string) map[string]string

func RotateMatrix

func RotateMatrix(input map[string]*Tile) map[string]*Tile

Rotates the tile 90 degrees clockwise, removing any relationships this tile has

func Shuffle

func Shuffle(currentCup int, newIndexRequired int, data []int) []int

func ToXY

func ToXY(key string) (float64, int)

func ValidateMatrix

func ValidateMatrix(matrix map[string]*Tile) (string, bool)

Types

type Allergen

type Allergen struct {
	Value       string
	Foods       map[string]*Food
	Ingredients map[string]*Ingredient
}

func (*Allergen) AddFood

func (allergen *Allergen) AddFood(food *Food)

func (*Allergen) AddIngredient

func (allergen *Allergen) AddIngredient(ingredient *Ingredient)

func (*Allergen) CreateSharedIngredientsAcrossFoods

func (allergen *Allergen) CreateSharedIngredientsAcrossFoods() []string

func (*Allergen) RemoveIngredient

func (allergen *Allergen) RemoveIngredient(value string)

type Application

type Application struct {
	CLI     *cli.CLI
	Verbose bool
}

func NewApplication

func NewApplication(cli *cli.CLI) Application

func (*Application) AOC_2020_05_part1_attempt1

func (app *Application) AOC_2020_05_part1_attempt1(cli *cli.CLI)

func (*Application) AOC_2020_05_part2_attempt1

func (app *Application) AOC_2020_05_part2_attempt1(cli *cli.CLI)

func (Application) Api

func (app Application) Api(day int) string

func (Application) GetMethod

func (app Application) GetMethod(methodName string) (reflect.Value, reflect.Value, bool)

func (Application) GetName

func (app Application) GetName() string

func (Application) GetPuzzle

func (app Application) GetPuzzle(year int, day int) utils.Puzzle

func (Application) Help

func (app Application) Help(cli *cli.CLI)

func (Application) List

func (app Application) List() string

func (Application) Render

func (app Application) Render(cli *cli.CLI)

func (Application) Run

func (app Application) Run(cli *cli.CLI)

func (Application) Summary

func (app Application) Summary(year int, day int) *utils.Summary

func (*Application) Y2020D01P1

func (app *Application) Y2020D01P1()

func (*Application) Y2020D01P2

func (app *Application) Y2020D01P2()

func (*Application) Y2020D01_Summary

func (app *Application) Y2020D01_Summary() *utils.Summary

func (*Application) Y2020D02P1

func (app *Application) Y2020D02P1()

func (*Application) Y2020D02P2

func (app *Application) Y2020D02P2()

func (*Application) Y2020D02_Summary

func (app *Application) Y2020D02_Summary() *utils.Summary

func (*Application) Y2020D03P1

func (app *Application) Y2020D03P1()

AOC_2020_03 is the entrypoint

func (*Application) Y2020D03P2

func (app *Application) Y2020D03P2()

func (*Application) Y2020D03_Summary

func (app *Application) Y2020D03_Summary() *utils.Summary

func (*Application) Y2020D04P1

func (app *Application) Y2020D04P1()

AOC_2020_04 is the entrypoint

func (*Application) Y2020D04P2

func (app *Application) Y2020D04P2()

func (*Application) Y2020D04_Summary

func (app *Application) Y2020D04_Summary() *utils.Summary

func (*Application) Y2020D05

func (app *Application) Y2020D05()

func (*Application) Y2020D05P1

func (app *Application) Y2020D05P1()

func (*Application) Y2020D05P2

func (app *Application) Y2020D05P2()

func (*Application) Y2020D05_Summary

func (app *Application) Y2020D05_Summary() *utils.Summary

func (*Application) Y2020D06P1

func (app *Application) Y2020D06P1()

AOC_2020_06 is the entrypoint

func (*Application) Y2020D06P2

func (app *Application) Y2020D06P2()

func (*Application) Y2020D06_Summary

func (app *Application) Y2020D06_Summary() *utils.Summary

func (*Application) Y2020D07P1

func (app *Application) Y2020D07P1()

AOC_2020_07 is the entrypoint

func (*Application) Y2020D07P2

func (app *Application) Y2020D07P2()

func (*Application) Y2020D07_Summary

func (app *Application) Y2020D07_Summary() *utils.Summary

func (*Application) Y2020D08P1

func (app *Application) Y2020D08P1()

AOC_2020_08 is the entrypoint

func (*Application) Y2020D08P2

func (app *Application) Y2020D08P2()

func (*Application) Y2020D08_Summary

func (app *Application) Y2020D08_Summary() *utils.Summary

func (*Application) Y2020D09P1

func (app *Application) Y2020D09P1()

AOC_2020_09 is the entrypoint

func (*Application) Y2020D09P2

func (app *Application) Y2020D09P2()

func (*Application) Y2020D09_Summary

func (app *Application) Y2020D09_Summary() *utils.Summary

func (*Application) Y2020D10P1

func (app *Application) Y2020D10P1()

AOC_2020_10 is the entrypoint

func (*Application) Y2020D10P2

func (app *Application) Y2020D10P2()

func (*Application) Y2020D10_Summary

func (app *Application) Y2020D10_Summary() *utils.Summary

func (*Application) Y2020D11

func (app *Application) Y2020D11()

func (*Application) Y2020D11P1

func (app *Application) Y2020D11P1()

func (*Application) Y2020D11P2

func (app *Application) Y2020D11P2()

func (*Application) Y2020D11_Summary

func (app *Application) Y2020D11_Summary() *utils.Summary

func (*Application) Y2020D12

func (app *Application) Y2020D12()

func (*Application) Y2020D12P1

func (app *Application) Y2020D12P1()

func (*Application) Y2020D12P1_x

func (app *Application) Y2020D12P1_x(cli *cli.CLI)

func (*Application) Y2020D12P2

func (app *Application) Y2020D12P2()

func (*Application) Y2020D12_Summary

func (app *Application) Y2020D12_Summary() *utils.Summary

func (*Application) Y2020D13

func (app *Application) Y2020D13()

AOC_2020_13 is the entrypoint

func (*Application) Y2020D13P1

func (app *Application) Y2020D13P1()

func (*Application) Y2020D13P2

func (app *Application) Y2020D13P2()

func (*Application) Y2020D13_Summary

func (app *Application) Y2020D13_Summary() *utils.Summary

func (*Application) Y2020D14

func (app *Application) Y2020D14()

func (*Application) Y2020D14P1

func (app *Application) Y2020D14P1()

func (*Application) Y2020D14P2

func (app *Application) Y2020D14P2()

func (*Application) Y2020D14_Summary

func (app *Application) Y2020D14_Summary() *utils.Summary

func (*Application) Y2020D15

func (app *Application) Y2020D15()

func (*Application) Y2020D15P1

func (app *Application) Y2020D15P1()

func (*Application) Y2020D15P2

func (app *Application) Y2020D15P2()

func (*Application) Y2020D15_Summary

func (app *Application) Y2020D15_Summary() *utils.Summary

func (*Application) Y2020D16

func (app *Application) Y2020D16()

func (*Application) Y2020D16P1

func (app *Application) Y2020D16P1()

func (*Application) Y2020D16P2

func (app *Application) Y2020D16P2()

func (*Application) Y2020D16_Summary

func (app *Application) Y2020D16_Summary() *utils.Summary

func (*Application) Y2020D17

func (app *Application) Y2020D17()

func (*Application) Y2020D17P1

func (app *Application) Y2020D17P1()

func (*Application) Y2020D17P2

func (app *Application) Y2020D17P2()

func (*Application) Y2020D17_Summary

func (app *Application) Y2020D17_Summary() *utils.Summary

func (*Application) Y2020D18

func (app *Application) Y2020D18()

func (*Application) Y2020D18P1

func (app *Application) Y2020D18P1()

func (*Application) Y2020D18P2

func (app *Application) Y2020D18P2()

func (*Application) Y2020D18_Summary

func (app *Application) Y2020D18_Summary() *utils.Summary

func (*Application) Y2020D19

func (app *Application) Y2020D19()

func (*Application) Y2020D19P1

func (app *Application) Y2020D19P1()

func (*Application) Y2020D19P2

func (app *Application) Y2020D19P2()

func (*Application) Y2020D19_Summary

func (app *Application) Y2020D19_Summary() *utils.Summary

func (*Application) Y2020D20

func (app *Application) Y2020D20()

func (*Application) Y2020D20P1

func (app *Application) Y2020D20P1()

func (*Application) Y2020D20P2

func (app *Application) Y2020D20P2()

func (*Application) Y2020D20_Summary

func (app *Application) Y2020D20_Summary() *utils.Summary

func (*Application) Y2020D21

func (app *Application) Y2020D21()

func (*Application) Y2020D21P1

func (app *Application) Y2020D21P1()

func (*Application) Y2020D21P2

func (app *Application) Y2020D21P2()

func (*Application) Y2020D21_Summary

func (app *Application) Y2020D21_Summary() *utils.Summary

func (*Application) Y2020D22

func (app *Application) Y2020D22()

func (*Application) Y2020D22P1

func (app *Application) Y2020D22P1()

func (*Application) Y2020D22P2

func (app *Application) Y2020D22P2()

func (*Application) Y2020D22_Summary

func (app *Application) Y2020D22_Summary() *utils.Summary

func (*Application) Y2020D23

func (app *Application) Y2020D23()

func (*Application) Y2020D23P1

func (app *Application) Y2020D23P1()

func (*Application) Y2020D23P2

func (app *Application) Y2020D23P2()

func (*Application) Y2020D23_Summary

func (app *Application) Y2020D23_Summary() *utils.Summary

func (*Application) Y2020D24

func (app *Application) Y2020D24()

func (*Application) Y2020D24P1

func (app *Application) Y2020D24P1()

func (*Application) Y2020D24P2

func (app *Application) Y2020D24P2()

func (*Application) Y2020D24P2Render

func (app *Application) Y2020D24P2Render()

func (*Application) Y2020D24_Summary

func (app *Application) Y2020D24_Summary() *utils.Summary

func (*Application) Y2020D25

func (app *Application) Y2020D25()

func (*Application) Y2020D25P1

func (app *Application) Y2020D25P1()

func (*Application) Y2020D25P2

func (app *Application) Y2020D25P2()

func (*Application) Y2020D25_Summary

func (app *Application) Y2020D25_Summary() *utils.Summary

type Bag

type Bag struct {
	Colour   string
	Children []*BagRelation
	Parents  []*Bag
}

Bag is my own impl of a simple Tree I can walk later

func NewBag

func NewBag(line string) *Bag

func (*Bag) AddChild

func (b *Bag) AddChild(child *Bag, number int)

type BagGraph

type BagGraph struct {
	// contains filtered or unexported fields
}

func NewBagGraphFromFilename

func NewBagGraphFromFilename(filename string) *BagGraph

func NewBagGraphFromStrings

func NewBagGraphFromStrings(lines []string) *BagGraph

func (*BagGraph) Debug

func (graph *BagGraph) Debug()

func (*BagGraph) GetBagsThatCanContain

func (b *BagGraph) GetBagsThatCanContain(colour string) map[string]*Bag

func (*BagGraph) GetOrCreate

func (graph *BagGraph) GetOrCreate(colour string) *Bag

func (*BagGraph) GetTotalBagsContainedBy

func (b *BagGraph) GetTotalBagsContainedBy(colour string) int

type BagRelation

type BagRelation struct {
	*Bag
	Number int
}

type BoardingPass

type BoardingPass struct {
	// contains filtered or unexported fields
}

func LoadBoardingPassesFromFile

func LoadBoardingPassesFromFile(filename string) []*BoardingPass

func NewBoardingPass

func NewBoardingPass(line string) *BoardingPass

func (*BoardingPass) GetCol

func (bp *BoardingPass) GetCol() int

func (*BoardingPass) GetRow

func (bp *BoardingPass) GetRow() int

func (*BoardingPass) GetSeatId

func (bp *BoardingPass) GetSeatId() int

type Combat

type Combat struct {
	Player1 *Player
	Player2 *Player
	Round   int
}

func NewCombat

func NewCombat(cards string) *Combat

func (*Combat) GetRound

func (c *Combat) GetRound() int

func (*Combat) GetScore

func (c *Combat) GetScore() int

func (*Combat) GetWinner

func (c *Combat) GetWinner() *Player

func (*Combat) Play

func (c *Combat) Play()

func (*Combat) PlayDay2

func (c *Combat) PlayDay2()

type CrabCups

type CrabCups struct {
	OriginalData string
	Data         []int
}

func NewCrabCups

func NewCrabCups(input string) *CrabCups

func (*CrabCups) Play

func (cc *CrabCups) Play(Rounds int, DEBUG bool) string

func (*CrabCups) Play1

func (cc *CrabCups) Play1(Rounds int, DEBUG bool) string

func (*CrabCups) Reset

func (cc *CrabCups) Reset()

func (*CrabCups) StringValue

func (cc *CrabCups) StringValue() string

func (*CrabCups) StringValueAfter

func (cc *CrabCups) StringValueAfter(after string) string

type CrabCups2

type CrabCups2 struct {
	OriginalData string
	Data         []int
}

func NewCrabCups2

func NewCrabCups2(input string) *CrabCups2

func (*CrabCups2) Play

func (cc *CrabCups2) Play(Rounds int, DEBUG bool)

func (*CrabCups2) Reset

func (cc *CrabCups2) Reset()

type Cup

type Cup struct {
	Value int
	Next  *Cup
	Prev  *Cup
}

func (*Cup) AttachRight

func (c *Cup) AttachRight(toAttach *Cup)

Attaches / Inserts the passed cup to the right on this cup

func (*Cup) Detach

func (c *Cup) Detach() *Cup

Detach removes the cup from the Ring of Cups, returning itself

type Day14Program

type Day14Program struct {
	Instructions []string
	Position     int
	Memory       *Memory
}

func NewDay14ProgramFromFilename

func NewDay14ProgramFromFilename(filename string) *Day14Program

func NewDay14ProgramFromStrings

func NewDay14ProgramFromStrings(instructions []string) *Day14Program

func (*Day14Program) ConvertToBinary

func (p *Day14Program) ConvertToBinary(value string) string

func (*Day14Program) ConvertToBitSet

func (p *Day14Program) ConvertToBitSet(value string) *goutils.BitSet

func (*Day14Program) Debug

func (p *Day14Program) Debug()

func (*Day14Program) ExecuteV1

func (p *Day14Program) ExecuteV1(instruction string)

func (*Day14Program) ExecuteV2

func (p *Day14Program) ExecuteV2(instruction string)

func (*Day14Program) IsMask

func (p *Day14Program) IsMask(instruction string) bool

func (*Day14Program) IsMem

func (p *Day14Program) IsMem(instruction string) bool

func (*Day14Program) ParseMask

func (p *Day14Program) ParseMask(instruction string) *goutils.Mask

func (*Day14Program) ParseMem

func (p *Day14Program) ParseMem(instruction string) (string, string)

func (*Day14Program) RunV1

func (p *Day14Program) RunV1()

func (*Day14Program) RunV2

func (p *Day14Program) RunV2()

func (*Day14Program) Sum

func (p *Day14Program) Sum() int64

type Day16

type Day16 struct {
	Rules         []*Rule
	YourTicket    *Ticket
	NearbyTickets []*Ticket
}

func NewDay16

func NewDay16(data string) *Day16

func (*Day16) CalculateTicketOrder

func (d *Day16) CalculateTicketOrder() map[string][]int

func (*Day16) CalculateTicketOrderV1

func (d *Day16) CalculateTicketOrderV1() map[string][]int

func (*Day16) DiscardInvalidTickets

func (d *Day16) DiscardInvalidTickets()

func (*Day16) ErrorRate

func (d *Day16) ErrorRate() int

type Food

type Food struct {
	Key   string
	Value string

	Ingredients map[string]*Ingredient
	Allergens   map[string]*Allergen
}

func (*Food) AddAllergen

func (food *Food) AddAllergen(allergen *Allergen)

func (*Food) AddIngredient

func (food *Food) AddIngredient(ingredient *Ingredient)

func (*Food) ContainsAllergen

func (food *Food) ContainsAllergen(value string) bool

func (*Food) ContainsIngredient

func (food *Food) ContainsIngredient(value string) bool

func (*Food) NumberOfAllergens

func (food *Food) NumberOfAllergens() int

func (*Food) NumberOfIngredients

func (food *Food) NumberOfIngredients() int

func (*Food) RemoveAllergen

func (food *Food) RemoveAllergen(value string)

func (*Food) RemoveIngredient

func (food *Food) RemoveIngredient(value string)

type FoodDB

type FoodDB struct {
	Food        map[string]*Food
	Ingredients map[string]*Ingredient
	Allergens   map[string]*Allergen

	NoAllergens         map[string]bool
	IdentifiedAllergens map[string]string
}

func NewFoodDB

func NewFoodDB(data string) *FoodDB

func (*FoodDB) AddFood

func (db *FoodDB) AddFood(index int, line string) *Food

func (*FoodDB) Analyse

func (db *FoodDB) Analyse()

func (*FoodDB) BuildIngredientAllergyMap

func (db *FoodDB) BuildIngredientAllergyMap() map[string]string

func (*FoodDB) Debug

func (db *FoodDB) Debug() string

func (*FoodDB) GetAllergen

func (db *FoodDB) GetAllergen(value string) *Allergen

func (*FoodDB) GetIngredient

func (db *FoodDB) GetIngredient(value string) *Ingredient

func (*FoodDB) GetIngredientsWithoutAllergens

func (db *FoodDB) GetIngredientsWithoutAllergens() []*Ingredient

func (*FoodDB) RemoveAllergen

func (db *FoodDB) RemoveAllergen(value string)

func (*FoodDB) RemoveIngredient

func (db *FoodDB) RemoveIngredient(value string)

type Grid3D

type Grid3D struct {
	// contains filtered or unexported fields
}

func NewGrid3D

func NewGrid3D(input string) *Grid3D

func (*Grid3D) CountActiveNeighbours

func (g *Grid3D) CountActiveNeighbours(parentKey string) int

func (*Grid3D) CountActiveTotal

func (g *Grid3D) CountActiveTotal() int

func (*Grid3D) Cycle

func (g *Grid3D) Cycle()

func (*Grid3D) DebugZ

func (g *Grid3D) DebugZ(z int) string

func (*Grid3D) Dimensions

func (g *Grid3D) Dimensions() (goutils.Point3D, goutils.Point3D)

Dimensions returns the min/max points that exist

func (*Grid3D) Get

func (g *Grid3D) Get(key string) string

func (*Grid3D) Neighbours

func (g *Grid3D) Neighbours(parentKey string) []string

func (*Grid3D) ParseKey

func (g *Grid3D) ParseKey(key string) (int, int, int)

func (*Grid3D) Set

func (g *Grid3D) Set(key string, value string)

type Grid4D

type Grid4D struct {
	// contains filtered or unexported fields
}

func NewGrid4D

func NewGrid4D(input string) *Grid4D

func (*Grid4D) CountActiveNeighbours

func (g *Grid4D) CountActiveNeighbours(parentKey string) int

func (*Grid4D) CountActiveTotal

func (g *Grid4D) CountActiveTotal() int

func (*Grid4D) Cycle

func (g *Grid4D) Cycle()

func (*Grid4D) DebugZ

func (g *Grid4D) DebugZ(z int) string

func (*Grid4D) Dimensions

func (g *Grid4D) Dimensions() (goutils.Point4D, goutils.Point4D)

Dimensions returns the min/max points that exist

func (*Grid4D) Get

func (g *Grid4D) Get(key string) string

func (*Grid4D) Neighbours

func (g *Grid4D) Neighbours(parentKey string) []string

func (*Grid4D) ParseKey

func (g *Grid4D) ParseKey(key string) (int, int, int, int)

func (*Grid4D) Set

func (g *Grid4D) Set(key string, value string)

type Hex

type Hex struct {
	Grid *HexGrid

	White bool
	// contains filtered or unexported fields
}

func (*Hex) Copy

func (hex *Hex) Copy() *Hex

func (*Hex) East

func (hex *Hex) East() string

func (*Hex) Flip

func (h *Hex) Flip() *Hex

func (*Hex) Neighbours

func (hex *Hex) Neighbours() []string

func (*Hex) NorthEast

func (hex *Hex) NorthEast() string

func (*Hex) NorthWest

func (hex *Hex) NorthWest() string

func (*Hex) SouthEast

func (hex *Hex) SouthEast() string

func (*Hex) SouthWest

func (hex *Hex) SouthWest() string

func (*Hex) West

func (hex *Hex) West() string

type HexGrid

type HexGrid struct {
	Centre *Hex
	Cache  map[string]*Hex
}

func NewHexGrid

func NewHexGrid() *HexGrid

func (*HexGrid) BlackCount

func (grid *HexGrid) BlackCount() int

func (*HexGrid) CoordinatesCreateHexesAlongTheWay

func (grid *HexGrid) CoordinatesCreateHexesAlongTheWay(fullAddress string) (float64, int)

func (*HexGrid) CoordinatesDontCreateHexesAlongTheWay

func (grid *HexGrid) CoordinatesDontCreateHexesAlongTheWay(fullAddress string) (float64, int)

Coordinates returns the relative x,y of this address from the centre

func (*HexGrid) Dimensions

func (grid *HexGrid) Dimensions() (int, int)

TileHeight returns the number of tiles high this grid is

func (*HexGrid) FindByAddress

func (grid *HexGrid) FindByAddress(address string) *Hex

func (*HexGrid) FindByCoordinates

func (grid *HexGrid) FindByCoordinates(key string) *Hex

func (*HexGrid) Keys

func (grid *HexGrid) Keys() []string

func (*HexGrid) ParseAddress

func (g *HexGrid) ParseAddress(address string) []string

ParseAddress takes an address e.g. neeswseenwwswnwswswnw to [ ne, e, sw, se, e, nw, w, sw, nw, sw, sw, nw ]

func (*HexGrid) PlayPart1

func (grid *HexGrid) PlayPart1(instructions string)

func (*HexGrid) PlayPart2

func (grid *HexGrid) PlayPart2(day int) (int, int, int, int)

func (*HexGrid) Render

func (grid *HexGrid) Render(day int, filename string)

Render creates a jpeg of the day and tiles.

func (*HexGrid) RenderAnimation

func (grid *HexGrid) RenderAnimation(data string, filename string, days int, Delay int)

func (*HexGrid) RenderFrame

func (grid *HexGrid) RenderFrame(dc *gg.Context, day int) image.Image

type Image

type Image struct {
	TileIds []string
	TileMap map[string]*Tile
	Matrix  map[string]*Tile
}

func NewImageFromString

func NewImageFromString(data string) *Image

func (*Image) Arrange

func (image *Image) Arrange(DEBUG bool) map[string]*Tile

Arrange in this attempt will take the first tile and assign it 0,0 on my grid any connected tile will then have coordinates relative to this image

func (*Image) AttemptAttach

func (i *Image) AttemptAttach(t *Tile, candidate *Tile) bool

AttemptAttach will attempt to attach on any side to a Tile The tile will be rotated and flipped in all combinations to attempt to attach on any side then it will FlipHorizontal and attempt 4 times, then it will FlipVertical and attempt 4 times

func (*Image) Debug

func (image *Image) Debug(hideTileEdges bool, showBorderBetweenTiles bool, showCoordinates bool) string

Debug prints the arranged image out

func (*Image) GetTile

func (i *Image) GetTile(tileId string) *Tile

GetTile returns the tile keyed by its Id

func (*Image) Size

func (i *Image) Size() int

type Ingredient

type Ingredient struct {
	Value     string
	Foods     map[string]*Food
	Allergens map[string]*Allergen
}

func (*Ingredient) AddAllergen

func (ingredient *Ingredient) AddAllergen(allergen *Allergen)

func (*Ingredient) AddFood

func (ingredient *Ingredient) AddFood(food *Food)

func (*Ingredient) RemoveAllergen

func (ingredient *Ingredient) RemoveAllergen(value string)

type Instruction

type Instruction struct {
	Operation      string
	Argument       int
	ExecutionCount int
	ExecutedOnStep int
}

func NewInstruction

func NewInstruction(line string) *Instruction

func (*Instruction) Debug

func (i *Instruction) Debug()

type Memory

type Memory struct {
	Mask *goutils.Mask
	// contains filtered or unexported fields
}

func NewMemory

func NewMemory() *Memory

func (*Memory) Debug

func (m *Memory) Debug()

func (*Memory) Get

func (m *Memory) Get(index int) *goutils.BitSet

func (*Memory) GetMask

func (m *Memory) GetMask() *goutils.Mask

func (*Memory) Set

func (m *Memory) Set(index int, value int64)

func (*Memory) SetMask

func (m *Memory) SetMask(mask *goutils.Mask)

func (*Memory) SetV2

func (m *Memory) SetV2(index int, value int64)

func (*Memory) Sum

func (m *Memory) Sum() int64

type Movement

type Movement struct {
	Command string
	Value   int
}

type Passport

type Passport struct {
	// contains filtered or unexported fields
}

func NewPassport

func NewPassport() *Passport

func (*Passport) Add

func (p *Passport) Add(line string)

func (*Passport) Debug

func (p *Passport) Debug()

func (*Passport) Get

func (p *Passport) Get(key string) (string, bool)

func (*Passport) IsValid

func (p *Passport) IsValid() bool

func (*Passport) IsValidECL

func (p *Passport) IsValidECL() bool

func (*Passport) IsValidHCL

func (p *Passport) IsValidHCL() bool

func (*Passport) IsValidHGT

func (p *Passport) IsValidHGT() bool

func (*Passport) IsValidPID

func (p *Passport) IsValidPID() bool

func (*Passport) IsValidPart2

func (p *Passport) IsValidPart2() bool

func (*Passport) Size

func (p *Passport) Size() int

type PassportControl

type PassportControl struct {
	// contains filtered or unexported fields
}

TobogganMap represents the whole snow field

func NewPassportControlFromFile

func NewPassportControlFromFile(filename string) *PassportControl

NewPassportControlFromString constructs and populates a snowy field from the passed filename

func NewPassportControlFromString

func NewPassportControlFromString(lines []string) *PassportControl

func (*PassportControl) Get

func (pc *PassportControl) Get(index int) *Passport

func (*PassportControl) Size

func (pc *PassportControl) Size() int

type Path

type Path struct {
	// contains filtered or unexported fields
}

func NewPathFromFile

func NewPathFromFile(filename string) *Path

func (*Path) Debug

func (p *Path) Debug()

type Player

type Player struct {
	Cards []int
}

func (*Player) AddCard

func (player *Player) AddCard(card int)

func (*Player) Copy

func (player *Player) Copy(numberOfCardsToCopy int) *Player

Copy is a simple copy constructor with one caveat, it only copies the nuuber of cards specified

func (*Player) Draw

func (player *Player) Draw() int

func (*Player) GetScore

func (player *Player) GetScore() int

func (*Player) Size

func (player *Player) Size() int

type Program

type Program struct {
	Instructions []*Instruction
	Accumulator  int
	Index        int
	CurrentStep  int
}

func NewProgram

func NewProgram(lines []string) *Program

func NewProgramFromFilename

func NewProgramFromFilename(filename string) *Program

func (*Program) Debug

func (p *Program) Debug()

func (*Program) FindInstructionIndexes

func (p *Program) FindInstructionIndexes(operation string) []int

Returns the posiiton of all Instructions with the specified Operation type

func (*Program) GetCurrentInstruction

func (p *Program) GetCurrentInstruction() *Instruction

GetCurrentInstruct returns the Instruction at the current Index

func (*Program) GetInstructionAtIndex

func (p *Program) GetInstructionAtIndex(index int) *Instruction

GetInstructionAtIndex returns the instruct at any index

func (*Program) IsComplete

func (p *Program) IsComplete() bool

IsComplete indicates if the program has completed

func (*Program) Reset

func (p *Program) Reset()

Reset set the Program to the original state, Index and Accumulator to 0

func (*Program) Size

func (p *Program) Size() int

func (*Program) Step

func (p *Program) Step() bool

Performs the current instruction, moving the index to the next valid value returns true if the instruction executes and continues normally returns false if the insruction executes and puts us into an infinite loop

type QandA

type QandA struct {
	// contains filtered or unexported fields
}

func NewQandA

func NewQandA(content string) *QandA

func NewQandAFromFile

func NewQandAFromFile(filename string) *QandA

func (*QandA) SecondTotalForAllGroups

func (q *QandA) SecondTotalForAllGroups() int

func (*QandA) TotalForAllGroups

func (q *QandA) TotalForAllGroups() int

parse queries the content in QandA to store total answer

func (*QandA) ValidCharacter

func (q *QandA) ValidCharacter(answer string) bool

type RegexRule

type RegexRule struct {
	Line      string // the original line    1: 2 3 | 3 2
	Key       string // the rule id 1
	Value     string // the 2 3 | 3 2
	Evaluated bool   // indicates if the regex has been evaluated
	Regex     string // the regex for this rule
	FullRegex string // the "full" regex composing all regexes (after evaluation)
	Attempt   int
	IsLooping bool
}

func NewRegexRule

func NewRegexRule(line string) *RegexRule

func (*RegexRule) Debug

func (rr *RegexRule) Debug() string

func (*RegexRule) IsMessageValid

func (rr *RegexRule) IsMessageValid(message string) bool

func (*RegexRule) Replace

func (rr *RegexRule) Replace(rule *RegexRule)

Replace replaces references to the passed rule with the actual regex of the passed rule

type RegexRuleEngine

type RegexRuleEngine struct {
	Rules    map[string]*RegexRule
	Messages []string
}

func NewRegexRuleEngine

func NewRegexRuleEngine(input string) *RegexRuleEngine

func (*RegexRuleEngine) Apply

func (r *RegexRuleEngine) Apply(ruleId string, debug bool) (int, []string)

func (*RegexRuleEngine) CheckMessage

func (r *RegexRuleEngine) CheckMessage(message string) (*RegexRule, bool)

func (*RegexRuleEngine) Debug

func (r *RegexRuleEngine) Debug()

func (*RegexRuleEngine) ParseRules

func (r *RegexRuleEngine) ParseRules(DEBUG bool)

Init parses all Rules to create RegexRules

func (*RegexRuleEngine) ParseRulesV2

func (r *RegexRuleEngine) ParseRulesV2()

Init parses all Rules to create RegexRules

func (*RegexRuleEngine) ParseRulesV3

func (r *RegexRuleEngine) ParseRulesV3()

func (*RegexRuleEngine) RemoveMessages

func (rre *RegexRuleEngine) RemoveMessages(messages []string)

type Ring

type Ring struct {
	Current *Cup
	Max     *Cup
	Min     *Cup
	Size    int
	Cache   map[int]*Cup
}

func NewRing

func NewRing(data []int) *Ring

func (*Ring) Debug

func (r *Ring) Debug(round int) string

Debug unrolls the Ring starting at Current - round

func (*Ring) Find

func (r *Ring) Find(value int) *Cup

func (*Ring) Play

func (r *Ring) Play(rounds int, DEBUG bool)

type Rule

type Rule struct {
	Name string
	// contains filtered or unexported fields
}

func NewRule

func NewRule(line string) *Rule

NewRule receives a line "arrival location: 46-401 or 418-964" and parses to Name, range1, range2

func (*Rule) Passes

func (r *Rule) Passes(value int) bool

Passes(int) indicates if the int is inside the rule range

type SeatingPlan

type SeatingPlan struct {
	TickCount int // the number of ticks that have happened
	// contains filtered or unexported fields
}

func NewSeatingPlanFromFile

func NewSeatingPlanFromFile(filename string, tolerance int, searchFar bool) *SeatingPlan

func NewSeatingPlanFromStrings

func NewSeatingPlanFromStrings(lines []string, tolerance int, searchFar bool) *SeatingPlan

func (*SeatingPlan) ColRowFromIndex

func (sp *SeatingPlan) ColRowFromIndex(index int) (int, int)

func (*SeatingPlan) ConvertAtIndex

func (sp *SeatingPlan) ConvertAtIndex(index int) int

func (*SeatingPlan) CountAdjacentOccupied

func (sp *SeatingPlan) CountAdjacentOccupied(index int) int

CountOccupied checks occupancy in all directions

func (*SeatingPlan) Debug

func (sp *SeatingPlan) Debug() string

func (*SeatingPlan) Get

func (sp *SeatingPlan) Get(col int, row int) int

func (*SeatingPlan) GetOccupiedCount

func (sp *SeatingPlan) GetOccupiedCount() int

func (*SeatingPlan) IndexFromColRow

func (sp *SeatingPlan) IndexFromColRow(col int, row int) int

func (*SeatingPlan) Put

func (sp *SeatingPlan) Put(position int, value int)

func (*SeatingPlan) Tick

func (sp *SeatingPlan) Tick() int

Tick performs one round of the seating change logic, returning the number of changes made in this round

func (*SeatingPlan) Translate

func (sp *SeatingPlan) Translate(value int) string

type Sequence

type Sequence struct {
	// contains filtered or unexported fields
}

func NewSequenceFromFilename

func NewSequenceFromFilename(filename string, preamble int) *Sequence

func NewSequenceFromInts

func NewSequenceFromInts(values []int, preamble int) *Sequence

func (*Sequence) ContainsCombination

func (s *Sequence) ContainsCombination(totalToFind int) (bool, int, int)

Searches this sequence for the combination, indicating true/false, index1, index2

func (*Sequence) ContainsValue

func (s *Sequence) ContainsValue(valueToFind int) (bool, int)

func (*Sequence) Get

func (s *Sequence) Get(index int) int

func (*Sequence) IndexOf

func (s *Sequence) IndexOf(valueToFind int) int

func (*Sequence) IsValid

func (s *Sequence) IsValid(index int) bool

func (*Sequence) Size

func (s *Sequence) Size() int

func (*Sequence) Subsequence

func (s *Sequence) Subsequence(position int) *Sequence

Returns the previous N entries from index X. ordered ascending

type Ship

type Ship struct {
	X     int
	Y     int
	Angle int
}

func NewShip

func NewShip() *Ship

func (*Ship) Execute

func (s *Ship) Execute(m *Movement)

type Ship2

type Ship2 struct {
	X        int
	Y        int
	Angle    int
	Waypoint *Waypoint
}

func NewShip2

func NewShip2(waypoint_x int, waypoint_y int) *Ship2

func (*Ship2) Execute

func (s *Ship2) Execute(m *Movement)

type Ticket

type Ticket struct {
	PassedRules []*Rule
	FailedRules []*Rule
	IntMap      *goutils.IntMap
	// contains filtered or unexported fields
}

func NewTicket

func NewTicket(line string) *Ticket

NewTicket holds the rules to 395,342,197,865,990,525,912,377,278,897,799,366,464,689,398,901,597,204,667,546

func (*Ticket) ErrorRate

func (t *Ticket) ErrorRate(rules []*Rule) int

PassesRule indicates if the Ticket meets the passed Rule

type Tile

type Tile struct {
	TileId string
	Matrix map[string]string

	Size int

	NorthEdge string // the string "edge" of teh tile e.g. #....##.##
	SouthEdge string
	EastEdge  string
	WestEdge  string

	NorthTile *Tile // when joined to another tile, this is the relationship
	SouthTile *Tile
	EastTile  *Tile
	WestTile  *Tile

	Rotation int

	IsEvaluated bool
	// contains filtered or unexported fields
}

func NewTile

func NewTile(id string, data []string) *Tile

func NewTileFromString

func NewTileFromString(data string) *Tile

func (*Tile) AttachAnyConnection

func (t *Tile) AttachAnyConnection(candidate *Tile) int

AttachAnyConnection attaches to the candidate either NSEW, bool indicates if it attached does NOT rotate any tile, will just attach if it can, will not attach if already attached

func (*Tile) AttachEast

func (t *Tile) AttachEast(candidate *Tile)

func (*Tile) AttachNorth

func (t *Tile) AttachNorth(candidate *Tile)

func (*Tile) AttachSouth

func (t *Tile) AttachSouth(candidate *Tile)

Attaches to the South of the passed tile

func (*Tile) AttachWest

func (t *Tile) AttachWest(candidate *Tile)

func (*Tile) CanRotateOrFlip

func (t *Tile) CanRotateOrFlip() bool

func (*Tile) Copy

func (toCopy *Tile) Copy() *Tile

func (*Tile) Debug

func (t *Tile) Debug(hideEdges bool) string

func (*Tile) Detach

func (tile *Tile) Detach()

Detach removes all connections between the passed Tile and the NSEW tiles it has

func (*Tile) FindSeaMonsters

func (tile *Tile) FindSeaMonsters() map[string][][]string

func (*Tile) FlipHorizontal

func (t *Tile) FlipHorizontal() *Tile

FlipHorizontal Performs a Horizontal 'flip' of the Tile

func (*Tile) FlipVertical

func (t *Tile) FlipVertical() *Tile

FlipVertical Performs a Vertical 'flip' of the Tile

func (*Tile) Get

func (t *Tile) Get(col int, row int) string

Get returns the char value at col,row e.g. # or .

func (*Tile) GetConnectionName

func (t *Tile) GetConnectionName(other *Tile) string

func (*Tile) IsBottomLeftCorner

func (t *Tile) IsBottomLeftCorner() bool

func (*Tile) IsBottomRightCorner

func (t *Tile) IsBottomRightCorner() bool

func (*Tile) IsComplete

func (t *Tile) IsComplete() bool

func (*Tile) IsEastOf

func (t *Tile) IsEastOf(candidate *Tile) bool

IsWestOf indicates if this can attach to the west of the candidate tile

func (*Tile) IsNorthOf

func (t *Tile) IsNorthOf(candidate *Tile) bool

IsNorthOf indicates if this can attach to the north of the candidate tile

func (*Tile) IsSeaMonster

func (tile *Tile) IsSeaMonster(candidate []string) (bool, []string, []string, []string)

func (*Tile) IsSouthOf

func (t *Tile) IsSouthOf(candidate *Tile) bool

IsSouthOf indicates if this can attach to the south of the candidate tile

func (*Tile) IsTopLeftCorner

func (t *Tile) IsTopLeftCorner() bool

func (*Tile) IsTopRightCorner

func (t *Tile) IsTopRightCorner() bool

func (*Tile) IsWestOf

func (t *Tile) IsWestOf(candidate *Tile) bool

IsWestOf indicates if this can attach to the west of the candidate tile

func (*Tile) KeyValue

func (tile *Tile) KeyValue(key string) int

func (*Tile) Keys

func (tile *Tile) Keys() []string

Keys builds every key combination

func (*Tile) Rekey

func (t *Tile) Rekey() *Tile

/ Rekey rebuilds the keys for each direction

func (*Tile) Rotate

func (t *Tile) Rotate() *Tile

Rotates the tile 90 degrees clockwise, removing any relationships this tile has

func (*Tile) RotateUntilAllRegexMatch

func (tile *Tile) RotateUntilAllRegexMatch() bool

func (*Tile) SetCanRotateOrFlip

func (t *Tile) SetCanRotateOrFlip(canRotateOrFlip bool)

func (*Tile) Snapshot

func (tile *Tile) Snapshot(x int, y int, width int, height int, content []string) []string

func (*Tile) TotalConnections

func (t *Tile) TotalConnections() int

TotalConnections - returns the nnuber of connections this tile has

type TobogganMap

type TobogganMap struct {
	// contains filtered or unexported fields
}

TobogganMap represents the whole snow field

func NewTobogganMap

func NewTobogganMap() *TobogganMap

NewTobogganMap constructs a new empty snowy field

func NewTobogganMapFromFile

func NewTobogganMapFromFile(filename string) *TobogganMap

NewTobogganMapFromFile constructs and populates a snowy field from the passed filename

func (*TobogganMap) Add

func (tm *TobogganMap) Add(line string) int

Add appends a snowy line to the Map

func (*TobogganMap) CountTreesWeEncounter

func (tm *TobogganMap) CountTreesWeEncounter(moveColsBy int, moveRowsBy int) int

CountTreesWeEncounter a general purpose walk to the bottom and keep moving right where I moduluse the move right

func (*TobogganMap) Debug

func (tm *TobogganMap) Debug()

Debug prints to STDOUT the map

func (*TobogganMap) Get

func (tm *TobogganMap) Get(col int, row int) string

Get returns the entry at col/row

func (*TobogganMap) GetRow

func (tm *TobogganMap) GetRow(row int) *TobogganMapRow

GetRow returns a specific 0-indexed row from the snowy field

func (*TobogganMap) IsTree

func (tm *TobogganMap) IsTree(col int, row int) bool

IsTree indicates if we've landed on a tree

func (*TobogganMap) Size

func (tm *TobogganMap) Size() int

Size tells me how deep the map is

type TobogganMapRow

type TobogganMapRow struct {
	// contains filtered or unexported fields
}

TobogganMapRow represents a single line of snow and trees

func (*TobogganMapRow) Debug

func (row *TobogganMapRow) Debug()

Debug prints this snowly line out to STDOUT

func (*TobogganMapRow) Get

func (row *TobogganMapRow) Get(index int) string

Get returns the thing that exists at position index; modulus the index as the row repeats

func (*TobogganMapRow) IsTree

func (row *TobogganMapRow) IsTree(col int) bool

IsTree indicates if we have landed on a tree

type ValueData

type ValueData struct {
	Value              int
	LastTurn           int
	LastTurnBeforeThat int
	Count              int
}

func NewValueData

func NewValueData(key int) *ValueData

type ValueStore

type ValueStore struct {
	Values map[int]*ValueData
}

func NewValueStore

func NewValueStore() *ValueStore

func (*ValueStore) Get

func (v *ValueStore) Get(key int) *ValueData

func (*ValueStore) Increment

func (v *ValueStore) Increment(key int, iteration int) int

type Waypoint

type Waypoint struct {
	X int
	Y int
}

type WeirdCalculator

type WeirdCalculator struct {
}

func NewWeirdCalculator

func NewWeirdCalculator() *WeirdCalculator

func (*WeirdCalculator) Calculate

func (c *WeirdCalculator) Calculate(sum string) int

func (*WeirdCalculator) CalculateV2

func (c *WeirdCalculator) CalculateV2(sum string) int

func (*WeirdCalculator) Debug

func (c *WeirdCalculator) Debug(sum string, expected int)

func (*WeirdCalculator) DebugV2

func (c *WeirdCalculator) DebugV2(sum string, expected int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL