Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/Broderick-Westrope/tetrigo
/ functions
Functions
276 in github.com/Broderick-Westrope/tetrigo
⨍
Functions
276
◇
Types & classes
56
↓ 35 callers
Method
Run
(globals *GlobalVars)
cmd/tetrigo/subcommands.go:16
↓ 26 callers
Method
Return
(_a0 int)
internal/tui/components/mock_Stopwatch.go:105
↓ 14 callers
Method
View
()
internal/tui/components/timer.go:13
↓ 11 callers
Function
FatalErrorCmd
FatalErrorCmd returns a command for creating a new FatalErrorMsg with the given error.
internal/tui/messages.go:9
↓ 10 callers
Method
EXPECT
()
internal/tui/components/mock_Stopwatch.go:21
↓ 10 callers
Method
Run
(run func())
internal/tui/components/mock_Stopwatch.go:98
↓ 9 callers
Method
Init
()
internal/tui/components/timer.go:11
↓ 8 callers
Method
DeepCopy
()
pkg/tetris/matrix.go:49
↓ 8 callers
Method
Update
(tea.Msg)
internal/tui/components/timer.go:12
↓ 6 callers
Method
CalculateFallSpeeds
(level int)
pkg/tetris/fall.go:20
↓ 6 callers
Function
DefaultKeys
()
internal/config/keys.go:16
↓ 6 callers
Function
DefaultTheme
()
internal/config/theme.go:24
↓ 6 callers
Function
NewSingleModel
( in *tui.SingleInput, cfg *config.Config, opts ...func(*SingleModel), )
internal/tui/views/single.go:70
↓ 6 callers
Method
Next
Next returns the next Tetrimino, removing it from the queue and refilling if necessary. This applies the skyline value (provided in NewNextQueue) to t
pkg/tetris/next_queue.go:45
↓ 5 callers
Method
Elapsed
()
internal/tui/components/stopwatch.go:14
↓ 5 callers
Function
NewLeaderboardModel
(in *tui.LeaderboardInput, db *sql.DB)
internal/tui/views/leaderboard.go:31
↓ 5 callers
Method
Toggle
()
internal/tui/components/timer.go:18
↓ 5 callers
Function
WithRandSource
(r *rand.Rand)
internal/tui/views/single.go:146
↓ 4 callers
Method
AddTetrimino
AddTetrimino adds the given Tetrimino to the Matrix. It returns an error if the Tetrimino is out of bounds or if the Tetrimino overlaps with an occupi
pkg/tetris/matrix.go:86
↓ 4 callers
Method
GetSkyline
GetSkyline returns the skyline; the highest row that the player can see.
pkg/tetris/matrix.go:40
↓ 4 callers
Method
IsValid
()
pkg/tetris/action.go:108
↓ 4 callers
Method
MoveDown
MoveDown moves the tetrimino down one row. This does not modify the matrix. If the tetrimino cannot move down, it will not be modified and false will
pkg/tetris/tetrimino.go:227
↓ 4 callers
Function
NewNextQueue
NewNextQueue creates a new NextQueue of Tetriminos.
pkg/tetris/next_queue.go:16
↓ 4 callers
Function
SetupInMemoryDB
(t *testing.T)
internal/tui/testutils/testutils.go:34
↓ 4 callers
Method
String
()
internal/tui/mode.go:45
↓ 4 callers
Function
SwitchModeCmd
(target Mode, in SwitchModeInput)
internal/tui/mode.go:18
↓ 4 callers
Method
canPlaceInCell
(row, col int)
pkg/tetris/matrix.go:161
↓ 4 callers
Function
isCellEmpty
(cell byte)
pkg/tetris/matrix.go:157
↓ 4 callers
Method
setupNewTetInPlay
setupNewTetInPlay will do the following setup for the new Tetrimino in play: - If possible, move down one row into the visible Matrix. - Check for Loc
pkg/tetris/modes/single/single.go:255
↓ 4 callers
Method
triggerGameOver
()
internal/tui/views/single.go:501
↓ 4 callers
Method
updateGhost
()
pkg/tetris/modes/single/single.go:280
↓ 3 callers
Method
AddSoftDrop
AddSoftDrop adds points for a soft drop.
pkg/tetris/scoring.go:74
↓ 3 callers
Method
DeepCopy
DeepCopy creates a deep copy of the Tetrimino. This is useful when you need to modify a Tetrimino without affecting the original.
pkg/tetris/tetrimino.go:434
↓ 3 callers
Function
DefaultMatrix
DefaultMatrix creates a new Matrix with a height of 40 and a width of 10.
pkg/tetris/matrix.go:12
↓ 3 callers
Method
ID
()
internal/tui/components/timer.go:14
↓ 3 callers
Method
IsGameOver
()
pkg/tetris/modes/single/getters.go:9
↓ 3 callers
Method
Level
Level returns the current level.
pkg/tetris/scoring.go:59
↓ 3 callers
Function
NewFall
(level int)
pkg/tetris/fall.go:14
↓ 3 callers
Function
NewLeaderboardRepository
(db *sql.DB)
internal/data/leaderboard.go:23
↓ 3 callers
Function
NewMatrix
NewMatrix creates a new Matrix with the given height and width. It returns an error if the height is less than 20 to allow for a buffer zone of 20 lin
pkg/tetris/matrix.go:22
↓ 3 callers
Function
NewMenuInput
()
internal/tui/mode.go:69
↓ 3 callers
Function
NewMenuModel
(_ *tui.MenuInput)
internal/tui/views/menu.go:40
↓ 3 callers
Function
NewMockStopwatch
NewMockStopwatch creates a new instance of MockStopwatch. It also registers a testing interface on the mock and a cleanup function to assert the mocks
internal/tui/components/mock_Stopwatch.go:443
↓ 3 callers
Function
NewStopwatchWithInterval
(interval time.Duration)
internal/tui/components/stopwatch.go:26
↓ 3 callers
Method
Rotate
Rotate rotates the Tetrimino clockwise or counter-clockwise. This does not modify the matrix. This will automatically use Super Rotation System (SRS).
pkg/tetris/tetrimino.go:291
↓ 3 callers
Method
Save
Save saves a score to the leaderboard and returns the ID of the new score.
internal/data/leaderboard.go:51
↓ 3 callers
Method
Stop
()
internal/tui/components/timer.go:17
↓ 3 callers
Method
ToggleSoftDrop
()
pkg/tetris/fall.go:29
↓ 3 callers
Function
WaitForMsgOfType
(t *testing.T, tm *teatest.TestModel, msgCh chan T, timeout time.Duration)
internal/tui/testutils/testutils.go:14
↓ 3 callers
Method
fill
fill adds Tetriminos to the queue until it has 7 or more. This is done by getting all valid Tetriminos, shuffling them, and adding them to the queue.
pkg/tetris/next_queue.go:59
↓ 3 callers
Function
launchStarter
(globals *GlobalVars, starterMode tui.Mode, switchIn tui.SwitchModeInput)
cmd/tetrigo/subcommands.go:49
↓ 3 callers
Function
positiveMod
positiveMod calculates the positive modulus of the dividend and divisor. This is used to handle negative numbers in a way that is consistent with the
pkg/tetris/tetrimino.go:411
↓ 3 callers
Method
renderCell
(cell byte)
internal/tui/views/single.go:484
↓ 3 callers
Method
transpose
transpose transposes the Tetrimino's cells. This is used during rotation to rotate the Tetrimino.
pkg/tetris/tetrimino.go:393
↓ 2 callers
Method
AddHardDrop
AddHardDrop adds points for a hard drop.
pkg/tetris/scoring.go:79
↓ 2 callers
Function
EnsureTablesExist
(db *sql.DB)
internal/data/data.go:24
↓ 2 callers
Method
GetDefaultFallInterval
()
pkg/tetris/modes/single/getters.go:50
↓ 2 callers
Method
GetLevel
()
pkg/tetris/modes/single/getters.go:42
↓ 2 callers
Method
GetLinesCleared
()
pkg/tetris/modes/single/getters.go:46
↓ 2 callers
Function
GetTetrimino
GetTetrimino returns the Tetrmino with the given value. Valid values are: I, O, T, S, Z, J, L.
pkg/tetris/tetrimino.go:208
↓ 2 callers
Method
GetTotalScore
()
pkg/tetris/modes/single/getters.go:38
↓ 2 callers
Method
IsAboveSkyline
IsAboveSkyline returns true if the entire Tetrimino is above the skyline. This can be helpful when checking for Lock Out.
pkg/tetris/tetrimino.go:469
↓ 2 callers
Method
IsValid
IsValid returns true if the given Tetrimino is within the bounds of the matrix and does not overlap with any occupied cells. If checkBounds is false,
pkg/tetris/tetrimino.go:487
↓ 2 callers
Method
Lines
Lines returns the total lines cleared.
pkg/tetris/scoring.go:69
↓ 2 callers
Method
MoveLeft
MoveLeft moves the tetrimino left one column. This does not modify the matrix. If the tetrimino cannot move left false will be returned.
pkg/tetris/tetrimino.go:248
↓ 2 callers
Method
MoveRight
MoveRight moves the tetrimino right one column. This does not modify the matrix. If the tetrimino cannot move right false will be returned.
pkg/tetris/tetrimino.go:269
↓ 2 callers
Function
NewLeaderboardInput
(gameMode string, opts ...func(input *LeaderboardInput))
internal/tui/mode.go:80
↓ 2 callers
Function
NewScoring
NewScoring creates a new scoring system.
pkg/tetris/scoring.go:25
↓ 2 callers
Function
NewSingleInput
(mode Mode, level int, username string)
internal/tui/mode.go:57
↓ 2 callers
Method
ProcessAction
ProcessAction processes an action and updates the score, lines cleared, level, etc. The returned boolean indicates if the game should end.
pkg/tetris/scoring.go:85
↓ 2 callers
Method
RemoveCompletedLines
RemoveCompletedLines checks each row that the given Tetrimino occupies and removes any completed lines from the Matrix. It returns an Action to be use
pkg/tetris/matrix.go:125
↓ 2 callers
Method
Reset
()
internal/tui/components/stopwatch.go:17
↓ 2 callers
Method
SetInterval
(time.Duration)
internal/tui/components/stopwatch.go:15
↓ 2 callers
Method
String
String returns the string representation of the Action.
pkg/tetris/action.go:75
↓ 2 callers
Method
Total
Total returns the total score.
pkg/tetris/scoring.go:64
↓ 2 callers
Function
deepCopyCells
deepCopyCells creates a deep copy of the given 2D grid of cells.
pkg/tetris/tetrimino.go:423
↓ 2 callers
Function
getMapOfValidTetriminos
()
pkg/tetris/tetrimino.go:118
↓ 2 callers
Method
initChild
()
internal/tui/starter/model.go:140
↓ 2 callers
Method
isLineComplete
(row int)
pkg/tetris/matrix.go:58
↓ 2 callers
Method
isOutOfBoundsHorizontally
(col int)
pkg/tetris/matrix.go:149
↓ 2 callers
Method
isOutOfBoundsVertically
(row int)
pkg/tetris/matrix.go:153
↓ 2 callers
Method
lowerTetInPlay
lowerTetInPlay moves the current Tetrimino down one row if possible. If it cannot be moved down this will instead remove completed lines, calculate sc
pkg/tetris/modes/single/single.go:220
↓ 2 callers
Method
modifyCell
(minos [][]bool, pos Coordinate, newValue byte, isExpectedValue func(byte) bool)
pkg/tetris/matrix.go:90
↓ 2 callers
Method
removeLine
(row int)
pkg/tetris/matrix.go:67
↓ 2 callers
Method
renderTetrimino
(t *tetris.Tetrimino, background byte)
internal/tui/views/single.go:469
↓ 2 callers
Method
rotateClockwise
rotateClockwise rotates the Tetrimino clockwise. This does not modify the matrix. If a valid rotation is found, the rotation point is returned. If no
pkg/tetris/tetrimino.go:325
↓ 2 callers
Method
rotateCounterClockwise
rotateCounterClockwise rotates the Tetrimino counter-clockwise. This does not modify the matrix. If a valid rotation is found, the rotation point is r
pkg/tetris/tetrimino.go:357
↓ 2 callers
Method
setChild
(mode tui.Mode, switchIn tui.SwitchModeInput)
internal/tui/starter/model.go:99
↓ 2 callers
Function
stringToAction
(s string)
pkg/tetris/action.go:101
↓ 2 callers
Method
togglePause
()
internal/tui/views/single.go:516
↓ 1 callers
Method
All
(gameMode string)
internal/data/leaderboard.go:27
↓ 1 callers
Function
ConstructGameKeyMap
(keys *config.Keys)
internal/tui/components/game_keys.go:23
↓ 1 callers
Function
CreateGameStyles
(theme *config.Theme)
internal/tui/components/game_styles.go:32
↓ 1 callers
Method
EndGame
EndGame sets Game.gameOver to true.
pkg/tetris/modes/single/single.go:211
↓ 1 callers
Method
EndsBackToBack
()
pkg/tetris/action.go:116
↓ 1 callers
Method
GetBagTetriminos
()
pkg/tetris/modes/single/getters.go:30
↓ 1 callers
Function
GetConfig
(path string)
internal/config/config.go:34
↓ 1 callers
Method
GetElements
GetElements returns the Tetriminos in the queue.
pkg/tetris/next_queue.go:39
↓ 1 callers
Function
GetEmptyTetrimino
GetEmptyTetrimino returns a tetrimino to be used for the starting (empty) hold.
pkg/tetris/tetrimino.go:217
↓ 1 callers
Method
GetHeight
GetHeight returns the height of the Matrix.
pkg/tetris/matrix.go:35
next →
1–100 of 276, ranked by callers