hole

package
v0.0.0-...-c3d1f1e Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All[T any](ts []T, pred func(T) bool) bool

Types

type Answer

type Answer = config.HoleAnswer

Alias HoleAnswer into this package to reduce boilerplate in every callsite.

type DFAState

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

type DFAStateTransition

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

type GridBox

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

type GridBoxSolution

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

type GridSolution

type GridSolution []GridBoxSolution

type GridTestCase

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

type Judge

type Judge func(run Run) string

An ultimate task of a Judge is to tell whether a run is passing or not. However, it does more. When the output is not recognised as correct, it returns a similar output that is.

type NFAResult

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

type NFAState

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

type NFAStateTransition

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

type Node

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

type ReversiBoard

type ReversiBoard [reversiGridSize][reversiGridSize]ReversiTile

type ReversiSpot

type ReversiSpot struct {
	Pos   [2]int
	Tiles [][2]int
}

type ReversiTile

type ReversiTile int8
const (
	Empty ReversiTile = iota
	Black
	White
	PotentialSpot
)

type Run

type Run struct {
	Answer                string        `json:"answer"`
	Code                  string        `json:"-"`
	MultisetItemDelimiter string        `json:"multiset_item_delimiter"`
	OutputDelimiter       string        `json:"output_delimiter"`
	Args                  []string      `json:"args"`
	ExitCode              int           `json:"exit_code"`
	Pass                  bool          `json:"pass"`
	Stderr                string        `json:"stderr"`
	Stdout                string        `json:"stdout"`
	Time                  time.Duration `json:"time_ns,format:nano"`
	Timeout               bool          `json:"timeout"`

	// This is a bit hacky, the only way to discover how long an assembly
	// solution is is to compile it so we store it here but don't JSON it.
	ASMBytes int `json:"-"`
}

Run holds the results of running a given solution once.

func Play

func Play(
	ctx context.Context, hole *config.Hole, lang *config.Lang, code string,
) ([]Run, error)

Play a given hole, in a given lang, with given code and return the runs.

type SingleOutputJudge

type SingleOutputJudge func(arg, userOutput, rawExpectedOutput string) string

A judge for a single output (corresponding to either a single input or a single preset output item)

Jump to

Keyboard shortcuts

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