src/pon2/app/simulator

Search:
Group by:
Source   Edit  

This module implements simulators.

Compile Options:

OptionDescriptionDefault
-d:pon2.path=<str>Path of the web studio./pon2/stable/studio/

Types

Simulator = object
Simulator for Puyo Puyo and Nazo Puyo. Source   Edit  
SimulatorEditData = object
  selecting*: tuple[cellOpt: Opt[Cell], crossOpt: Opt[bool]]
  field*: tuple[row: Row, col: Col]
  steps*: tuple[index: int, pivot: bool, col: Col]
  focusField*: bool
  insert*: bool
Edit information. Source   Edit  
SimulatorMode {.pure.} = enum
  PlayViewer, PlayEditor, EditViewer, EditEditor, Replay
Simulator's mode. Source   Edit  
SimulatorState {.pure.} = enum
  Stable, WillPop, WillSettle, AfterEdit
Simulator's state. Source   Edit  

Consts

EditModes = {SimulatorMode.EditViewer, SimulatorMode.EditEditor}
Source   Edit  
EditorModes = {SimulatorMode.PlayEditor, SimulatorMode.EditEditor}
Source   Edit  
PlayModes = {SimulatorMode.PlayViewer, SimulatorMode.PlayEditor}
Source   Edit  
Pon2Path {.define: "pon2.path".} = "/pon2/stable/studio/"
Source   Edit  
ViewerModes = {SimulatorMode.PlayViewer, SimulatorMode.EditViewer}
Source   Edit  

Procs

func backward(self: var Simulator; detail = false) {....raises: [], tags: [],
    forbids: [].}
Backwards the simulator. Source   Edit  
func delStep(self: var Simulator; index: int) {....raises: [], tags: [],
    forbids: [].}
Deletes the step at the specified index. Source   Edit  
func editData(self: Simulator): SimulatorEditData {....raises: [], tags: [],
    forbids: [].}
Returns the edit information of the simulator. Source   Edit  
func flip(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Flips the field or the step. Source   Edit  
func flipFieldHorizontal(self: var Simulator) {....raises: [], tags: [],
    forbids: [].}
Flips the field horizontally. Source   Edit  
func flipFieldVertical(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Flips the field vertically. Source   Edit  
func forward(self: var Simulator; replay = false; skip = false) {....raises: [],
    tags: [], forbids: [].}
Forwards the simulator. This functions requires that the initial field is settled. skip is prioritized over replay. Source   Edit  
func goalClearColorOpt=(self: var Simulator; clearColorOpt: Opt[GoalColor]) {.
    ...raises: [], tags: [], forbids: [].}
Sets the goal clear color. Source   Edit  
func goalColor=(self: var Simulator; color: GoalColor) {....raises: [], tags: [],
    forbids: [].}
Sets the goal color. Source   Edit  
func goalKindOpt=(self: var Simulator; kindOpt: Opt[GoalKind]) {....raises: [],
    tags: [], forbids: [].}
Sets the goal kind. Source   Edit  
func goalOperator=(self: var Simulator; operator: GoalOperator) {....raises: [],
    tags: [], forbids: [].}
Sets the goal operator. Source   Edit  
func goalVal=(self: var Simulator; val: int) {....raises: [], tags: [], forbids: [].}
Sets the goal value. Source   Edit  
func init(T: type Simulator; mode = DefaultMode): T:type {....raises: [].}
Source   Edit  
func init(T: type Simulator; nazoPuyo: NazoPuyo; mode = DefaultMode): T:type {.
    ...raises: [].}
Source   Edit  
func init(T: type Simulator; puyoPuyo: PuyoPuyo; mode = DefaultMode): T:type {.
    ...raises: [].}
Source   Edit  
func mark(self: Simulator): MarkResult {....raises: [], tags: [], forbids: [].}
Marks the steps in the Nazo Puyo in the simulator. Source   Edit  
func mode(self: Simulator): SimulatorMode {....raises: [], tags: [], forbids: [].}
Returns the mode of the simulator. Source   Edit  
func mode=(self: var Simulator; mode: SimulatorMode) {....raises: [], tags: [],
    forbids: [].}
Sets the mode of the simulator. Source   Edit  
func moveCursorDown(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Moves the cursor downward. Source   Edit  
func moveCursorLeft(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Moves the cursor leftward. Source   Edit  
func moveCursorRight(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Moves the cursor rightward. Source   Edit  
func moveCursorUp(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Moves the cursor upward. Source   Edit  
func movePlacementLeft(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Moves the next placement left. Source   Edit  
func movePlacementRight(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Moves the next placement right. Source   Edit  
func moveResult(self: Simulator): MoveResult {....raises: [], tags: [], forbids: [].}
Returns the moving result of the simulator. Source   Edit  
func nazoPuyo(self: Simulator): NazoPuyo {....raises: [], tags: [], forbids: [].}
Returns the Nazo Puyo in the simulator. Source   Edit  
func normalizeGoal(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Normalizes the goal. This function does not affects undo/redo. Source   Edit  
func operate(self: var Simulator; key: KeyEvent): bool {.discardable,
    ...raises: [], tags: [], forbids: [].}
Performs an action specified by the key. Returns true if the key is handled. Source   Edit  
func operating(self: Simulator): tuple[index: int, placement: Placement] {.
    ...raises: [], tags: [], forbids: [].}
Returns the operating data of the simulator. Source   Edit  
func parseSimulator(uri: Uri): Pon2Result[Simulator] {....raises: [], tags: [],
    forbids: [].}
Returns the simulator converted from the URI. Viewer modes are set to the result simulator preferentially if the FQDN is IshikawaPuyo or Ips. Source   Edit  
func redo(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Performs redo. Source   Edit  
func reset(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Backwards the simulator to the pre-move state. Source   Edit  
func rotatePlacementLeft(self: var Simulator) {....raises: [], tags: [],
    forbids: [].}
Rotates the next placement left (counterclockwise). Source   Edit  
func rotatePlacementRight(self: var Simulator) {....raises: [], tags: [],
    forbids: [].}
Rotates the next placement right (clockwise). Source   Edit  
func rule(self: Simulator): Rule {....raises: [], tags: [], forbids: [].}
Returns the rule of the Nazo Puyo in the simulator. Source   Edit  
func rule=(self: var Simulator; rule: Rule) {....raises: [], tags: [], forbids: [].}
Sets the rule of the simulator. Source   Edit  
func selectingCell=(self: var Simulator; cell: Cell) {....raises: [], tags: [],
    forbids: [].}
Sets the selecting cell. Source   Edit  
func selectingCross=(self: var Simulator; cross: bool) {....raises: [], tags: [],
    forbids: [].}
Sets the selecting cross. Source   Edit  
func setRule(self: var Simulator; rule: Rule) {....raises: [], tags: [],
    forbids: [].}
Sets the rule of the simulator. This function is a "safe" version. Source   Edit  
func shiftFieldDown(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Shifts the field downward. Source   Edit  
func shiftFieldLeft(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Shifts the field leftward. Source   Edit  
func shiftFieldRight(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Shifts the field rightward. Source   Edit  
func shiftFieldUp(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Shifts the field upward. Source   Edit  
func state(self: Simulator): SimulatorState {....raises: [], tags: [], forbids: [].}
Returns the state of the simulator. Source   Edit  
func toExportUri(self: Simulator; viewer = true; clearPlacements = true;
                 fqdn = Pon2): Pon2Result[Uri] {....raises: [], tags: [],
    forbids: [].}
Returns the URI of the simulator with any moves reset. Source   Edit  
func toggleFocus(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Toggles focusing field or not. Source   Edit  
func toggleInsert(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Toggles inserting or not. Source   Edit  
func toUri(self: Simulator; clearPlacements = false; fqdn = Pon2): Pon2Result[
    Uri] {....raises: [], tags: [], forbids: [].}
Returns the URI converted from the simulator. Source   Edit  
func undo(self: var Simulator) {....raises: [], tags: [], forbids: [].}
Performs undo. Source   Edit  
func writeCell(self: var Simulator; cell: Cell) {....raises: [], tags: [],
    forbids: [].}
Writes the cell to the selecting position in the field or steps. Source   Edit  
func writeCell(self: var Simulator; index: int; pivot: bool) {....raises: [],
    tags: [], forbids: [].}
Writes the selecting cell to the specified position in the steps. Source   Edit  
func writeCell(self: var Simulator; row: Row; col: Col) {....raises: [], tags: [],
    forbids: [].}
Writes the selecting cell to the specified position in the field. Source   Edit  
func writeCount(self: var Simulator; count: int) {....raises: [], tags: [],
    forbids: [].}
Writes the nuisance count to the selecting position in the steps. Source   Edit  
func writeCount(self: var Simulator; index: int; col: Col; count: int) {.
    ...raises: [], tags: [], forbids: [].}
Writes the nuisance count to the specified position in the steps. Source   Edit  
func writeCountClamp(self: var Simulator; index: int; col: Col; count: int) {.
    ...raises: [], tags: [], forbids: [].}
Writes the nuisance clamped count to the specified position in the steps. Source   Edit  
func writeCross(self: var Simulator; cross: bool) {....raises: [], tags: [],
    forbids: [].}
Writes the rotation to the selecting position in the steps. Source   Edit  
func writeCross(self: var Simulator; index: int) {....raises: [], tags: [],
    forbids: [].}
Writes the selecting rotation to the specified position in the steps. Source   Edit  

Exports

puyoCount, $, cellCount, puyoCount, parsePlacement, moveLeft, DeadRule, score, puyoCount, del, rotatedLeft, $, init, cellCount, Field, puyoCount, nuisancePuyoCount, swapped, init, MoveResult, parseRule, mark, validDoublePlacements, coloredPuyoCount, pivotCol, init, ==, parseNazoPuyo, coloredPuyoCounts, init, parseStep, NuisancePuyos, Width, init, $, Rule, GoalOperator, Pair, toUriQuery, cellCount, isNormalized, $, movedLeft, GoalMain, rotateRight, AirHeight, puyoCount, MarkResult, connection2Vertical, colorsSeq, del, init, shiftRight, rotor, isValid, init, canPop, $, Steps, toUriQuery, ActualPlacements, Dir, init, cellCount, invalidPlacements, connection3, []=, shiftUp, puyoCount, NoneGoalColor, parseGoal, connection2Horizontal, init, rotatedRight, dropNuisance, placeCounts, toUriQuery, rotateLeft, SimulatorFqdn, nuisancePuyoCount, cellCount, init, init, parseSteps, nuisancePuyoCount, validPlacements, toUriQuery, DoublePlacements, movedRight, init, toUriQuery, parsePair, Notice, coloredPuyoCount, cellCount, nuisancePuyoCount, WaterTopRow, StepKind, init, cellCounts, Physics, isDouble, swap, WaterHeight, coloredPuyoCount, connection2, Col, Step, coloredPuyoCount, insert, toArray, parseSimulatorFqdn, init, parsePuyoPuyo, Cell, connectionCounts, rotorDir, init, Puyos, parseNazoPuyo, NoneGoalMain, parsePuyoPuyo, [], apply, puyoCount, nuisancePuyoCounts, ColoredPuyos, Behaviour, toField, noticeCounts, pivot=, Height, context, $, connection3LShape, isSupported, parseGoal, init, ==, isSettled, connectionCounts, PopResult, placeCounts, rotate, init, nuisancePuyoCount, toUriQuery, init, init, coloredPuyoCount, Row, isPopped, NoColorKinds, nuisancePuyoCount, init, init, parseStep, mpairs, connection3Horizontal, Placement, flipHorizontal, parseField, parsePair, isDead, puyoCounts, init, shiftDown, rotorCol, init, PuyoPuyo, init, flipVertical, pivot, Behaviours, shiftLeft, parseSteps, NazoPuyo, init, move, colors, parsePlacement, nuisancePuyoCount, toUriQuery, init, parseField, AirBottomRow, parseCell, cellCount, ColorKinds, normalized, place, insert, connectionCounts, GoalColor, Goal, Pon2Result, crossRotate, rotor=, init, connection3Vertical, noticeCounts, settle, toDeque, toUriQuery, coloredPuyoCount, moveRight, hardToGarbageCount, init, move, pop, NoneGoal, coloredPuyoCount, normalize, GoalKind