Terminal

package
v0.0.0-...-7ab42ae Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Display

func Display(terminal Terminal)

func GenerateMemoryBlock

func GenerateMemoryBlock(terminal Terminal, passStruct PassStruct) ([]Block, PassStruct)

Types

type AttemptBox

type AttemptBox struct {
	// The current lolumn
	TotalAttempts int
	// The current line
	RemainingAttempts int
	// The current line position
	Position MultiCoordinates
}

func (*AttemptBox) Init

func (a *AttemptBox) Init(t Terminal)

type Block

type Block struct {
	// A block contains all the necessary content to render that block
	// The content of that block, consisting of multiple lines
	Content  []Line
	Position MultiCoordinates
}

type Cursor

type Cursor struct {
	// The current lolumn
	ColumnNumber int
	// The current line
	LineNumber int
	// The current line position
	LinePosition int
	// The current Memory cell
	Cell String
	// The Line
	Line Line
}

func (*Cursor) Init

func (c *Cursor) Init(t Terminal)

Initializes the cursor at zero

type InputBox

type InputBox struct {
	// The current line position
	Position SimpleCoordinates
	// The last line length
	LastLength     int
	Messages       [][]string
	LongestMessage int
}

func (*InputBox) Init

func (i *InputBox) Init(t Terminal)

type Line

type Line struct {
	// Each line contains multiple sets of strings
	Content  []String
	Position MultiCoordinates
	Length   int
}

type MultiCoordinates

type MultiCoordinates struct {
	//
	Start SimpleCoordinates
	Mid   SimpleCoordinates
	End   SimpleCoordinates
}

type PassStruct

type PassStruct struct {
	Content         map[string]Password
	CorrectPassword string
	Listing         []string
}

func GeneratePasswords

func GeneratePasswords(passwordCount int) PassStruct

type Password

type Password struct {
	Content    string
	Correct    bool
	Length     int
	Similarity int

	Line         int
	LinePosition int
	Column       int
}

type SimpleBlock

type SimpleBlock struct {
	// A simpleblock just contains a number of lines with strings
	Content  []SimpleLine
	Position MultiCoordinates
}

func GenerateAddressBlocks

func GenerateAddressBlocks(AddressBlocks []SimpleBlock, settings TerminalSettings) []SimpleBlock

func GeneratePasswordBlock(lineCount int, lineWidth int, columnCount int, passwordCount int, passwords map[string]passStruct, passwordList []string) [][][]string {

type SimpleCoordinates

type SimpleCoordinates struct {
	// X position
	X int
	// Y position
	Y int
}

type SimpleLine

type SimpleLine struct {
	Content  string
	Position MultiCoordinates
}

type String

type String struct {
	Content    string
	Position   MultiCoordinates
	Length     int
	StringType string
	Attempted  bool
}

type Terminal

type Terminal struct {
	// The terminal settings
	Settings TerminalSettings

	// The color styling
	Style TerminalStyle
	// The header block
	Header SimpleBlock

	// The address block
	AddressBlocks []SimpleBlock

	// The memory blocks
	MemoryBlocks []Block

	// A and dict list of Passwords
	Passwords PassStruct
}

func NewTerminal

func NewTerminal(settings TerminalSettings) Terminal

type TerminalSettings

type TerminalSettings struct {
	// The number of lines to generate PER COLUMN
	Lines int

	// The number of columns to generate
	Columns int

	// The number of passwords to generate
	Passwords int

	// Padding from the left edge
	GeneralPaddingX int
	// The padding between Y0 and the Header
	HeaderPaddingTopY int

	// The padding between the enter password line, and the blocks
	HeaderPaddingBottomY int

	// The width of Memory Lines
	MemoryWidth int

	// The padding between Columns
	MemoryPaddingX int

	// The width of Address lines
	AddressWidth int

	// The padding between Address lines
	AddressPaddingX int

	// Total Attempts
	TotalAttempts int
}

Settings for the terminal window

func DefaultSettings

func DefaultSettings() TerminalSettings

type TerminalStyle

type TerminalStyle struct {
	Default      tcell.Style
	Highlight    tcell.Style
	LowDefault   tcell.Style
	LowHighlight tcell.Style
}

Jump to

Keyboard shortcuts

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