d7337d24ea
CI / changes (pull_request) Successful in 3s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Successful in 22s
CI / ui (pull_request) Successful in 1m16s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m48s
Russian "Эрудит" treats a word laid on the board as belonging to the game: it cannot be laid again. Neither the solver, the backend nor the offline JS port knew the rule, so a player (and the robot) could replay a word freely. Official Scrabble places no such restriction, so both Scrabble variants keep playing unrestricted. The rule applies in two ways. A play whose main word is already on the board is illegal, and is neither accepted nor generated. A play whose perpendicular cross-word is already there stands — that word is incidental to laying the main word — but scores nothing. The set of played words is the game's own move journal, main words and cross-words alike, compared decoded, so a word spelled with a blank is the same word. It lives in the game layer, not the solver: only a game knows its history, and the solver stays stateless and standard-rules. The backend applies it at submit, at the move preview and over generated moves (filtering and re-ranking them, so neither the robot nor the hint can offer a play the engine would then refuse); the client port does the same for the offline engine and for the on-device preview of an online game. The rule is pinned per game (games.no_repeat_words, set from the variant at creation) rather than keyed on the variant, because a game is replayed from its journal on every open. Applied retroactively it would make an already-played repeat illegal — closing that game as a draw — and would rescore a play whose cross-word repeats an earlier word, shifting a live game's totals. Games created before the rule keep playing without it. The flag rides the wire as a trailing field because the client's preview must score the way the server does, and offline games pin the same answer in their own record.
142 lines
6.2 KiB
Go
142 lines
6.2 KiB
Go
//
|
|
// Code generated by go-jet DO NOT EDIT.
|
|
//
|
|
// WARNING: Changes to this file may cause incorrect behavior
|
|
// and will be lost if the code is regenerated
|
|
//
|
|
|
|
package table
|
|
|
|
import (
|
|
"github.com/go-jet/jet/v2/postgres"
|
|
)
|
|
|
|
var Games = newGamesTable("backend", "games", "")
|
|
|
|
type gamesTable struct {
|
|
postgres.Table
|
|
|
|
// Columns
|
|
GameID postgres.ColumnString
|
|
Variant postgres.ColumnString
|
|
DictVersion postgres.ColumnString
|
|
Seed postgres.ColumnInteger
|
|
Status postgres.ColumnString
|
|
Players postgres.ColumnInteger
|
|
ToMove postgres.ColumnInteger
|
|
TurnStartedAt postgres.ColumnTimestampz
|
|
TurnTimeoutSecs postgres.ColumnInteger
|
|
HintsAllowed postgres.ColumnBool
|
|
HintsPerPlayer postgres.ColumnInteger
|
|
MoveCount postgres.ColumnInteger
|
|
EndReason postgres.ColumnString
|
|
CreatedAt postgres.ColumnTimestampz
|
|
UpdatedAt postgres.ColumnTimestampz
|
|
FinishedAt postgres.ColumnTimestampz
|
|
OpenDeadlineAt postgres.ColumnTimestampz
|
|
DropoutTiles postgres.ColumnString
|
|
MultipleWordsPerTurn postgres.ColumnBool
|
|
VsAi postgres.ColumnBool
|
|
GameKind postgres.ColumnInteger
|
|
NoRepeatWords postgres.ColumnBool
|
|
|
|
AllColumns postgres.ColumnList
|
|
MutableColumns postgres.ColumnList
|
|
DefaultColumns postgres.ColumnList
|
|
}
|
|
|
|
type GamesTable struct {
|
|
gamesTable
|
|
|
|
EXCLUDED gamesTable
|
|
}
|
|
|
|
// AS creates new GamesTable with assigned alias
|
|
func (a GamesTable) AS(alias string) *GamesTable {
|
|
return newGamesTable(a.SchemaName(), a.TableName(), alias)
|
|
}
|
|
|
|
// Schema creates new GamesTable with assigned schema name
|
|
func (a GamesTable) FromSchema(schemaName string) *GamesTable {
|
|
return newGamesTable(schemaName, a.TableName(), a.Alias())
|
|
}
|
|
|
|
// WithPrefix creates new GamesTable with assigned table prefix
|
|
func (a GamesTable) WithPrefix(prefix string) *GamesTable {
|
|
return newGamesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
|
}
|
|
|
|
// WithSuffix creates new GamesTable with assigned table suffix
|
|
func (a GamesTable) WithSuffix(suffix string) *GamesTable {
|
|
return newGamesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
|
}
|
|
|
|
func newGamesTable(schemaName, tableName, alias string) *GamesTable {
|
|
return &GamesTable{
|
|
gamesTable: newGamesTableImpl(schemaName, tableName, alias),
|
|
EXCLUDED: newGamesTableImpl("", "excluded", ""),
|
|
}
|
|
}
|
|
|
|
func newGamesTableImpl(schemaName, tableName, alias string) gamesTable {
|
|
var (
|
|
GameIDColumn = postgres.StringColumn("game_id")
|
|
VariantColumn = postgres.StringColumn("variant")
|
|
DictVersionColumn = postgres.StringColumn("dict_version")
|
|
SeedColumn = postgres.IntegerColumn("seed")
|
|
StatusColumn = postgres.StringColumn("status")
|
|
PlayersColumn = postgres.IntegerColumn("players")
|
|
ToMoveColumn = postgres.IntegerColumn("to_move")
|
|
TurnStartedAtColumn = postgres.TimestampzColumn("turn_started_at")
|
|
TurnTimeoutSecsColumn = postgres.IntegerColumn("turn_timeout_secs")
|
|
HintsAllowedColumn = postgres.BoolColumn("hints_allowed")
|
|
HintsPerPlayerColumn = postgres.IntegerColumn("hints_per_player")
|
|
MoveCountColumn = postgres.IntegerColumn("move_count")
|
|
EndReasonColumn = postgres.StringColumn("end_reason")
|
|
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
|
UpdatedAtColumn = postgres.TimestampzColumn("updated_at")
|
|
FinishedAtColumn = postgres.TimestampzColumn("finished_at")
|
|
OpenDeadlineAtColumn = postgres.TimestampzColumn("open_deadline_at")
|
|
DropoutTilesColumn = postgres.StringColumn("dropout_tiles")
|
|
MultipleWordsPerTurnColumn = postgres.BoolColumn("multiple_words_per_turn")
|
|
VsAiColumn = postgres.BoolColumn("vs_ai")
|
|
GameKindColumn = postgres.IntegerColumn("game_kind")
|
|
NoRepeatWordsColumn = postgres.BoolColumn("no_repeat_words")
|
|
allColumns = postgres.ColumnList{GameIDColumn, VariantColumn, DictVersionColumn, SeedColumn, StatusColumn, PlayersColumn, ToMoveColumn, TurnStartedAtColumn, TurnTimeoutSecsColumn, HintsAllowedColumn, HintsPerPlayerColumn, MoveCountColumn, EndReasonColumn, CreatedAtColumn, UpdatedAtColumn, FinishedAtColumn, OpenDeadlineAtColumn, DropoutTilesColumn, MultipleWordsPerTurnColumn, VsAiColumn, GameKindColumn, NoRepeatWordsColumn}
|
|
mutableColumns = postgres.ColumnList{VariantColumn, DictVersionColumn, SeedColumn, StatusColumn, PlayersColumn, ToMoveColumn, TurnStartedAtColumn, TurnTimeoutSecsColumn, HintsAllowedColumn, HintsPerPlayerColumn, MoveCountColumn, EndReasonColumn, CreatedAtColumn, UpdatedAtColumn, FinishedAtColumn, OpenDeadlineAtColumn, DropoutTilesColumn, MultipleWordsPerTurnColumn, VsAiColumn, GameKindColumn, NoRepeatWordsColumn}
|
|
defaultColumns = postgres.ColumnList{StatusColumn, ToMoveColumn, TurnStartedAtColumn, HintsAllowedColumn, HintsPerPlayerColumn, MoveCountColumn, CreatedAtColumn, UpdatedAtColumn, DropoutTilesColumn, MultipleWordsPerTurnColumn, VsAiColumn, GameKindColumn, NoRepeatWordsColumn}
|
|
)
|
|
|
|
return gamesTable{
|
|
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
|
|
|
//Columns
|
|
GameID: GameIDColumn,
|
|
Variant: VariantColumn,
|
|
DictVersion: DictVersionColumn,
|
|
Seed: SeedColumn,
|
|
Status: StatusColumn,
|
|
Players: PlayersColumn,
|
|
ToMove: ToMoveColumn,
|
|
TurnStartedAt: TurnStartedAtColumn,
|
|
TurnTimeoutSecs: TurnTimeoutSecsColumn,
|
|
HintsAllowed: HintsAllowedColumn,
|
|
HintsPerPlayer: HintsPerPlayerColumn,
|
|
MoveCount: MoveCountColumn,
|
|
EndReason: EndReasonColumn,
|
|
CreatedAt: CreatedAtColumn,
|
|
UpdatedAt: UpdatedAtColumn,
|
|
FinishedAt: FinishedAtColumn,
|
|
OpenDeadlineAt: OpenDeadlineAtColumn,
|
|
DropoutTiles: DropoutTilesColumn,
|
|
MultipleWordsPerTurn: MultipleWordsPerTurnColumn,
|
|
VsAi: VsAiColumn,
|
|
GameKind: GameKindColumn,
|
|
NoRepeatWords: NoRepeatWordsColumn,
|
|
|
|
AllColumns: allColumns,
|
|
MutableColumns: mutableColumns,
|
|
DefaultColumns: defaultColumns,
|
|
}
|
|
}
|