utils

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryStringToInt

func BinaryStringToInt(v string) int

Converts a decimal string to an integer value e.g. "11" -> utisl.BinaryStringToInt("11") = 3

func BinaryStringToInt64

func BinaryStringToInt64(v string) int64

func BinaryStringToUInt64

func BinaryStringToUInt64(v string) uint64

func CollapseRanges

func CollapseRanges(ranges [][]int) [][]int

a semi-functional collapsing function which finds overlaps and merges indexes

func ContainsString

func ContainsString(search string, data string) bool

func Gcd

func Gcd(a uint, b uint) uint

Recursive function to return gcd of a and b

func Lcm

func Lcm(a uint, b uint) uint

Function to return LCM of two numbers

func Lcm_x

func Lcm_x(data []uint) uint

func MaxInt

func MaxInt(a int, b int) int

func MinInt

func MinInt(a int, b int) int

func SplitDataToListOfInts

func SplitDataToListOfInts(data string, delim string) []int

reads some test data to a slice of ints

func ToInt

func ToInt(s string) int

Types

type AOCDay

type AOCDay interface {
	Part1() Problem
	Part2() Problem
}

type AppLogic

type AppLogic interface {
	Run(cli *cli.CLI)
	Render(cli *cli.CLI)
	// Help(cli *cli.CLI)
	GetMethod(methodName string) (reflect.Value, reflect.Value, bool)
	// GetName() string
	Api(day int) string
	Summary(year int, day int) *Summary
	GetPuzzle(year int, day int) Puzzle
}

type Entry

type Entry struct {
	Date    string
	Title   string
	Notes   string
	Summary *Summary
}

func NewEntry

func NewEntry(date string, title string, notes string, s *Summary) *Entry

type Node

type Node struct {
	ID                         string
	Children                   []*Node
	ChildrenIDs                []string
	IsOpen                     bool
	Value                      int
	OpenedAtMinute             int
	Parent                     *Node
	Dijkstra_TentativeDistance int
	Dijkstra_Visited           bool
}

func NewNode

func NewNode(input string) *Node

func (*Node) String

func (n *Node) String() string

type Problem

type Problem struct {
	Name          string // headline
	URL           string // the problem on AOC website
	StdOut        bool   // does it print the solution to STDout?
	API           bool   // is there an API I can call to get the solution and visualise it over the web?
	Visualisation bool   // can I visualise i over the web?
	Year          int    // YYYY
	Day           int    // 1..25
	Part          int    // 1 or 2
	GaveUp        bool   // has it defeated me
	InProgress    bool   // is it currently in progress
	Paused        bool   // have I stopped working on it for non giveup reasons
	Attempts      int    // how many times have I tried this
	Solved        bool   // did I manage it
	Complexity    int    // 0..N easy..complex
	Satisfaction  int    // 0..N  0=made me insane, 100 = so happy
	Effort        int    // how hard did I have to work (so, it might have been easy but took a lot because of data wrangling)
	Started       string // date time
	Completed     string // date time
	Notes         string // what did I think
	Concepts      string // what CS concepts, algos, data structures did I use
}

Each solution as I complete it should return the problems so I can do something (Websitey) with them for future reference

type Progress

type Progress int
const (
	Unknown Progress = iota
	NotStarted
	Started
	Failed
	Paused
	Completed
)

func (Progress) String

func (p Progress) String() string

type Puzzle

type Puzzle interface {
	Run()
	GetSummary() Summary
}

type Q

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

func NewQ

func NewQ() *Q

type Summary

type Summary struct {
	Name            string   // headline
	URL             string   // the problem on AOC website
	Year            int      // YYYY
	Day             int      // 1..25
	API             bool     // is there an API I can call to get the solution and visualise it over the web?
	StdOut          bool     // does it print the solution to stdout?
	VisualisationP1 bool     // can I visualise i over the web?
	VisualisationP2 bool     // can I visualise i over the web?
	ProgressP1      Progress // has it defeated me
	ProgressP2      Progress // has it defeated me
	Attempts        int      // how many times have I tried this
	ComplexityP1    int      // 0..N easy..complex
	ComplexityP2    int      // 0..N easy..complex
	SatisfactionP1  int      // 0..N  0=made me insane, 100 = so happy
	SatisfactionP2  int      // 0..N  0=made me insane, 100 = so happy
	EffortP1        int      // how hard did I have to work (so, it might have been easy but took a lot because of data wrangling)
	EffortP2        int      // how hard did I have to work (so, it might have been easy but took a lot because of data wrangling)
	DateStarted     string   // date time
	DateCompleted   string   // date time
	LastModified    string   // date time
	Concepts        string   // what CS concepts, algos, data structures did I use
	Entries         []*Entry
}

Each solution as I complete it should return the problems so I can do something (Websitey) with them for future reference

func NewSummary

func NewSummary(year int, day int) *Summary

Jump to

Keyboard shortcuts

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