brick-engine-js 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.local.example +2 -0
- package/.github/workflows/publish.yml +73 -0
- package/.prettierignore +2 -0
- package/.prettierrc.json +8 -0
- package/README.adoc +84 -0
- package/dist/8e23286c2fdf41fd795f.svg +32 -0
- package/dist/CNAME +1 -0
- package/dist/app.js +2 -0
- package/dist/app.js.map +1 -0
- package/dist/brick-engine.js +2 -0
- package/dist/brick-engine.js.map +1 -0
- package/dist/config/configs.d.ts +180 -0
- package/dist/config/configs.test.d.ts +1 -0
- package/dist/config/env.d.ts +2 -0
- package/dist/config/env.test.d.ts +1 -0
- package/dist/config/styles.d.ts +0 -0
- package/dist/core/Game.d.ts +107 -0
- package/dist/core/Game.test.d.ts +1 -0
- package/dist/core/InitialStateSnapshot.d.ts +19 -0
- package/dist/core/InitialStateSnapshot.test.d.ts +1 -0
- package/dist/core/helpers/CellHelper.d.ts +13 -0
- package/dist/core/helpers/CellHelper.test.d.ts +1 -0
- package/dist/core/helpers/ControlInputHandlerHelper.d.ts +32 -0
- package/dist/core/helpers/ControlInputHandlerHelper.test.d.ts +1 -0
- package/dist/core/helpers/CoordinateHelper.d.ts +54 -0
- package/dist/core/helpers/CoordinateHelper.test.d.ts +1 -0
- package/dist/core/helpers/InterfaceIdentifierHelper.d.ts +7 -0
- package/dist/core/helpers/InterfaceIdentifierHelper.test.d.ts +1 -0
- package/dist/core/helpers/RelativeValuesHelper.d.ts +23 -0
- package/dist/core/helpers/RelativeValuesHelper.test.d.ts +1 -0
- package/dist/core/module/control/GameControl.d.ts +62 -0
- package/dist/core/module/control/GameControl.test.d.ts +1 -0
- package/dist/core/module/control/GameControlKeyBinding.d.ts +36 -0
- package/dist/core/module/control/GameControlKeyBinding.test.d.ts +1 -0
- package/dist/core/module/grid/GameGrid.d.ts +399 -0
- package/dist/core/module/grid/GameGrid.test.d.ts +1 -0
- package/dist/core/module/grid/GameHudGrid.d.ts +24 -0
- package/dist/core/module/grid/GameHudGrid.test.d.ts +1 -0
- package/dist/core/module/grid/engines/GridAnalysisEngine.d.ts +29 -0
- package/dist/core/module/grid/engines/GridAnalysisEngine.test.d.ts +1 -0
- package/dist/core/module/grid/engines/GridLineEngine.d.ts +56 -0
- package/dist/core/module/grid/engines/GridLineEngine.test.d.ts +1 -0
- package/dist/core/module/grid/engines/GridMovementEngine.d.ts +29 -0
- package/dist/core/module/grid/engines/GridMovementEngine.test.d.ts +1 -0
- package/dist/core/module/grid/engines/GridRegionEngine.d.ts +26 -0
- package/dist/core/module/grid/engines/GridRegionEngine.test.d.ts +1 -0
- package/dist/core/module/grid/engines/GridTransformEngine.d.ts +24 -0
- package/dist/core/module/grid/engines/GridTransformEngine.test.d.ts +1 -0
- package/dist/core/module/renderer/DisplayRenderer.d.ts +51 -0
- package/dist/core/module/renderer/DisplayRenderer.test.d.ts +1 -0
- package/dist/core/module/renderer/GameRenderer.d.ts +59 -0
- package/dist/core/module/renderer/GameRenderer.test.d.ts +1 -0
- package/dist/core/module/renderer/HudRenderer.d.ts +56 -0
- package/dist/core/module/renderer/HudRenderer.test.d.ts +1 -0
- package/dist/core/module/score/GameScore.d.ts +117 -0
- package/dist/core/module/score/GameScore.test.d.ts +1 -0
- package/dist/core/module/session/GameSession.d.ts +20 -0
- package/dist/core/module/session/GameSession.test.d.ts +1 -0
- package/dist/core/module/sound/GameSound.d.ts +85 -0
- package/dist/core/module/sound/GameSound.test.d.ts +1 -0
- package/dist/core/module/state/GameState.d.ts +172 -0
- package/dist/core/module/state/GameState.test.d.ts +1 -0
- package/dist/core/module/text/GameText.d.ts +87 -0
- package/dist/core/module/text/GameText.test.d.ts +1 -0
- package/dist/core/module/time/GameTime.d.ts +76 -0
- package/dist/core/module/time/GameTime.test.d.ts +1 -0
- package/dist/core/types/Interfaces.d.ts +53 -0
- package/dist/core/types/Types.d.ts +114 -0
- package/dist/core/types/enums.d.ts +106 -0
- package/dist/core/types/modules.d.ts +723 -0
- package/dist/css/app.743066d8e4172b0e73f9.css +824 -0
- package/dist/css/app.743066d8e4172b0e73f9.css.map +1 -0
- package/dist/docs/GAME_DEVELOPER_GUIDE.html +727 -0
- package/dist/docs/brick-engine-guide.html +610 -0
- package/dist/docs/diagrams/lifecycle.mmd +19 -0
- package/dist/docs/documentation_style_guide.html +994 -0
- package/dist/docs/getting-started.html +648 -0
- package/dist/docs/images/lifecycle.svg +1 -0
- package/dist/docs/index.html +593 -0
- package/dist/docs/jsdoc_standard.html +656 -0
- package/dist/docs/publishing.html +573 -0
- package/dist/docs/reference/enums/Color.html +533 -0
- package/dist/docs/reference/enums/ControlEventType.html +505 -0
- package/dist/docs/reference/enums/ControlKey.html +529 -0
- package/dist/docs/reference/enums/FontAlignment.html +545 -0
- package/dist/docs/reference/enums/FontSize.html +517 -0
- package/dist/docs/reference/enums/Sound.html +558 -0
- package/dist/docs/reference/enums/StateProperty.html +525 -0
- package/dist/docs/reference/helpers/CellHelper.html +520 -0
- package/dist/docs/reference/helpers/ControlInputHandlerHelper.html +569 -0
- package/dist/docs/reference/helpers/CoordinateHelper.html +703 -0
- package/dist/docs/reference/helpers/RelativeValuesHelper.html +560 -0
- package/dist/docs/reference/interfaces/Debuggable.html +501 -0
- package/dist/docs/reference/interfaces/GameModules.html +544 -0
- package/dist/docs/reference/interfaces/Initializable.html +495 -0
- package/dist/docs/reference/interfaces/RendererInitializable.html +517 -0
- package/dist/docs/reference/interfaces/StateSyncable.html +542 -0
- package/dist/docs/reference/interfaces/modules/Control.html +648 -0
- package/dist/docs/reference/interfaces/modules/Grid.html +1256 -0
- package/dist/docs/reference/interfaces/modules/Renderer.html +522 -0
- package/dist/docs/reference/interfaces/modules/RendererComposite.html +577 -0
- package/dist/docs/reference/interfaces/modules/Score.html +669 -0
- package/dist/docs/reference/interfaces/modules/Session.html +585 -0
- package/dist/docs/reference/interfaces/modules/State.html +897 -0
- package/dist/docs/reference/interfaces/modules/Text.html +668 -0
- package/dist/docs/reference/interfaces/modules/Time.html +684 -0
- package/dist/docs/reference/modules/Debugger.html +579 -0
- package/dist/docs/reference/modules/DisplayRenderer.html +557 -0
- package/dist/docs/reference/modules/Game.html +909 -0
- package/dist/docs/reference/modules/GameControl.html +716 -0
- package/dist/docs/reference/modules/GameGrid.html +1910 -0
- package/dist/docs/reference/modules/GameHudGrid.html +508 -0
- package/dist/docs/reference/modules/GameMenu.html +538 -0
- package/dist/docs/reference/modules/GameRenderer.html +589 -0
- package/dist/docs/reference/modules/GameScore.html +664 -0
- package/dist/docs/reference/modules/GameSession.html +533 -0
- package/dist/docs/reference/modules/GameSound.html +636 -0
- package/dist/docs/reference/modules/GameState.html +922 -0
- package/dist/docs/reference/modules/GameText.html +701 -0
- package/dist/docs/reference/modules/GameTime.html +696 -0
- package/dist/docs/reference/modules/HudRenderer.html +568 -0
- package/dist/docs/reference/modules/InitialStateSnapshot.html +557 -0
- package/dist/docs/reference/modules/SessionModal.html +520 -0
- package/dist/docs/reference/types/Axis.html +505 -0
- package/dist/docs/reference/types/Cell.html +514 -0
- package/dist/docs/reference/types/ControlCallback.html +488 -0
- package/dist/docs/reference/types/Coordinate.html +510 -0
- package/dist/docs/reference/types/GameEntry.html +514 -0
- package/dist/docs/reference/types/GameEvent.html +514 -0
- package/dist/docs/reference/types/Piece.html +506 -0
- package/dist/docs/reference/types/RendererMetrics.html +514 -0
- package/dist/docs/reference/types/Vector.html +509 -0
- package/dist/docs/testing_best_practices.html +770 -0
- package/dist/favicon.ico +0 -0
- package/dist/fonts/digital-7.monoitalic.ttf +0 -0
- package/dist/images/cell.svg +32 -0
- package/dist/images/close.png +0 -0
- package/dist/images/games.png +0 -0
- package/dist/images/github.png +0 -0
- package/dist/images/letter-a.png +0 -0
- package/dist/images/letter-d.png +0 -0
- package/dist/images/letter-j.png +0 -0
- package/dist/images/letter-s.png +0 -0
- package/dist/images/letter-w.png +0 -0
- package/dist/images/meta-image.png +0 -0
- package/dist/images/number-1.png +0 -0
- package/dist/images/number-2.png +0 -0
- package/dist/images/number-3.png +0 -0
- package/dist/images/number-4.png +0 -0
- package/dist/images/number-5.png +0 -0
- package/dist/images/number-6.png +0 -0
- package/dist/images/splash.gif +0 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.html +1 -0
- package/dist/index.test.d.ts +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.test.d.ts +1 -0
- package/dist/menu/GameMenu.d.ts +15 -0
- package/dist/menu/GameMenu.test.d.ts +1 -0
- package/dist/menu/GameMenuSingleton.d.ts +6 -0
- package/dist/menu/GameMenuSingleton.test.d.ts +1 -0
- package/dist/menu/GameRepository.d.ts +7 -0
- package/dist/menu/GameRepository.test.d.ts +1 -0
- package/dist/menu/manager/GameManager.d.ts +6 -0
- package/dist/menu/manager/GameManager.test.d.ts +1 -0
- package/dist/sounds/sound_00.wav +0 -0
- package/dist/sounds/sound_01.wav +0 -0
- package/dist/sounds/sound_02.wav +0 -0
- package/dist/sounds/sound_03.wav +0 -0
- package/dist/sounds/sound_04.wav +0 -0
- package/dist/sounds/sound_05.wav +0 -0
- package/dist/sounds/sound_06.wav +0 -0
- package/dist/sounds/sound_07.wav +0 -0
- package/dist/sounds/sound_08.wav +0 -0
- package/dist/sounds/sound_09.wav +0 -0
- package/dist/sounds/sound_10.wav +0 -0
- package/dist/sounds/sound_11.wav +0 -0
- package/dist/sounds/sound_12.wav +0 -0
- package/dist/sounds/sound_13.wav +0 -0
- package/dist/sounds/sound_14.wav +0 -0
- package/dist/sounds/sound_15.wav +0 -0
- package/dist/types/interfaces.d.ts +5 -0
- package/dist/vendor/p5.min.js +1 -0
- package/dist/view/Debugger.d.ts +12 -0
- package/dist/view/Debugger.test.d.ts +1 -0
- package/dist/view/GameView.d.ts +101 -0
- package/dist/view/GameView.test.d.ts +1 -0
- package/dist/view/SessionModal.d.ts +12 -0
- package/dist/view/SessionModal.test.d.ts +4 -0
- package/dist/view/components/layout/ButtonLayout.d.ts +25 -0
- package/dist/view/components/layout/ButtonLayout.test.d.ts +1 -0
- package/dist/view/components/layout/ContainerLayout.d.ts +23 -0
- package/dist/view/components/layout/ContainerLayout.test.d.ts +1 -0
- package/dist/view/components/layout/FrameLayout.d.ts +11 -0
- package/dist/view/components/layout/FrameLayout.test.d.ts +1 -0
- package/dist/view/components/ui/BigButton.d.ts +13 -0
- package/dist/view/components/ui/BigButton.test.d.ts +1 -0
- package/dist/view/components/ui/Button.d.ts +12 -0
- package/dist/view/components/ui/Button.test.d.ts +1 -0
- package/dist/view/components/ui/Canvas.d.ts +22 -0
- package/dist/view/components/ui/Canvas.test.d.ts +1 -0
- package/dist/view/components/ui/SmallButton.d.ts +13 -0
- package/dist/view/components/ui/SmallButton.test.d.ts +1 -0
- package/dist/view/theme/applyColors.d.ts +10 -0
- package/dist/view/theme/applyColors.test.d.ts +1 -0
- package/dist/view/theme/dimensions.d.ts +13 -0
- package/dist/view/theme/dimensions.test.d.ts +1 -0
- package/docs/GAME_DEVELOPER_GUIDE.adoc +167 -0
- package/docs/brick-engine-guide.adoc +87 -0
- package/docs/diagrams/lifecycle.mmd +19 -0
- package/docs/documentation_style_guide.adoc +210 -0
- package/docs/getting-started.adoc +147 -0
- package/docs/images/lifecycle.svg +1 -0
- package/docs/jsdoc_standard.adoc +109 -0
- package/docs/publishing.adoc +58 -0
- package/docs/reference/enums/Color.adoc +35 -0
- package/docs/reference/enums/ControlEventType.adoc +28 -0
- package/docs/reference/enums/ControlKey.adoc +34 -0
- package/docs/reference/enums/FontAlignment.adoc +43 -0
- package/docs/reference/enums/FontSize.adoc +31 -0
- package/docs/reference/enums/Sound.adoc +42 -0
- package/docs/reference/enums/StateProperty.adoc +33 -0
- package/docs/reference/helpers/CellHelper.adoc +37 -0
- package/docs/reference/helpers/ControlInputHandlerHelper.adoc +57 -0
- package/docs/reference/helpers/CoordinateHelper.adoc +118 -0
- package/docs/reference/helpers/RelativeValuesHelper.adoc +53 -0
- package/docs/reference/interfaces/Debuggable.adoc +29 -0
- package/docs/reference/interfaces/GameModules.adoc +35 -0
- package/docs/reference/interfaces/Initializable.adoc +24 -0
- package/docs/reference/interfaces/RendererInitializable.adoc +33 -0
- package/docs/reference/interfaces/StateSyncable.adoc +41 -0
- package/docs/reference/interfaces/modules/Control.adoc +98 -0
- package/docs/reference/interfaces/modules/Grid.adoc +411 -0
- package/docs/reference/interfaces/modules/Renderer.adoc +34 -0
- package/docs/reference/interfaces/modules/RendererComposite.adoc +57 -0
- package/docs/reference/interfaces/modules/Score.adoc +107 -0
- package/docs/reference/interfaces/modules/Session.adoc +66 -0
- package/docs/reference/interfaces/modules/State.adoc +290 -0
- package/docs/reference/interfaces/modules/Text.adoc +110 -0
- package/docs/reference/interfaces/modules/Time.adoc +119 -0
- package/docs/reference/modules/Debugger.adoc +71 -0
- package/docs/reference/modules/DisplayRenderer.adoc +55 -0
- package/docs/reference/modules/Game.adoc +256 -0
- package/docs/reference/modules/GameControl.adoc +139 -0
- package/docs/reference/modules/GameGrid.adoc +794 -0
- package/docs/reference/modules/GameHudGrid.adoc +38 -0
- package/docs/reference/modules/GameMenu.adoc +39 -0
- package/docs/reference/modules/GameRenderer.adoc +79 -0
- package/docs/reference/modules/GameScore.adoc +138 -0
- package/docs/reference/modules/GameSession.adoc +43 -0
- package/docs/reference/modules/GameSound.adoc +111 -0
- package/docs/reference/modules/GameState.adoc +318 -0
- package/docs/reference/modules/GameText.adoc +139 -0
- package/docs/reference/modules/GameTime.adoc +141 -0
- package/docs/reference/modules/HudRenderer.adoc +56 -0
- package/docs/reference/modules/InitialStateSnapshot.adoc +47 -0
- package/docs/reference/modules/SessionModal.adoc +34 -0
- package/docs/reference/types/Axis.adoc +28 -0
- package/docs/reference/types/Cell.adoc +29 -0
- package/docs/reference/types/ControlCallback.adoc +23 -0
- package/docs/reference/types/Coordinate.adoc +29 -0
- package/docs/reference/types/GameEntry.adoc +29 -0
- package/docs/reference/types/GameEvent.adoc +29 -0
- package/docs/reference/types/Piece.adoc +32 -0
- package/docs/reference/types/RendererMetrics.adoc +29 -0
- package/docs/reference/types/Vector.adoc +28 -0
- package/docs/testing_best_practices.adoc +190 -0
- package/eslint.config.mjs +29 -0
- package/package.json +54 -0
- package/public/CNAME +1 -0
- package/public/docs/GAME_DEVELOPER_GUIDE.html +727 -0
- package/public/docs/brick-engine-guide.html +610 -0
- package/public/docs/diagrams/lifecycle.mmd +19 -0
- package/public/docs/documentation_style_guide.html +994 -0
- package/public/docs/getting-started.html +648 -0
- package/public/docs/images/lifecycle.svg +1 -0
- package/public/docs/index.html +593 -0
- package/public/docs/jsdoc_standard.html +656 -0
- package/public/docs/publishing.html +573 -0
- package/public/docs/reference/enums/Color.html +533 -0
- package/public/docs/reference/enums/ControlEventType.html +505 -0
- package/public/docs/reference/enums/ControlKey.html +529 -0
- package/public/docs/reference/enums/FontAlignment.html +545 -0
- package/public/docs/reference/enums/FontSize.html +517 -0
- package/public/docs/reference/enums/Sound.html +558 -0
- package/public/docs/reference/enums/StateProperty.html +525 -0
- package/public/docs/reference/helpers/CellHelper.html +520 -0
- package/public/docs/reference/helpers/ControlInputHandlerHelper.html +569 -0
- package/public/docs/reference/helpers/CoordinateHelper.html +703 -0
- package/public/docs/reference/helpers/RelativeValuesHelper.html +560 -0
- package/public/docs/reference/interfaces/Debuggable.html +501 -0
- package/public/docs/reference/interfaces/GameModules.html +544 -0
- package/public/docs/reference/interfaces/Initializable.html +495 -0
- package/public/docs/reference/interfaces/RendererInitializable.html +517 -0
- package/public/docs/reference/interfaces/StateSyncable.html +542 -0
- package/public/docs/reference/interfaces/modules/Control.html +648 -0
- package/public/docs/reference/interfaces/modules/Grid.html +1256 -0
- package/public/docs/reference/interfaces/modules/Renderer.html +522 -0
- package/public/docs/reference/interfaces/modules/RendererComposite.html +577 -0
- package/public/docs/reference/interfaces/modules/Score.html +669 -0
- package/public/docs/reference/interfaces/modules/Session.html +585 -0
- package/public/docs/reference/interfaces/modules/State.html +897 -0
- package/public/docs/reference/interfaces/modules/Text.html +668 -0
- package/public/docs/reference/interfaces/modules/Time.html +684 -0
- package/public/docs/reference/modules/Debugger.html +579 -0
- package/public/docs/reference/modules/DisplayRenderer.html +557 -0
- package/public/docs/reference/modules/Game.html +909 -0
- package/public/docs/reference/modules/GameControl.html +716 -0
- package/public/docs/reference/modules/GameGrid.html +1910 -0
- package/public/docs/reference/modules/GameHudGrid.html +508 -0
- package/public/docs/reference/modules/GameMenu.html +538 -0
- package/public/docs/reference/modules/GameRenderer.html +589 -0
- package/public/docs/reference/modules/GameScore.html +664 -0
- package/public/docs/reference/modules/GameSession.html +533 -0
- package/public/docs/reference/modules/GameSound.html +636 -0
- package/public/docs/reference/modules/GameState.html +922 -0
- package/public/docs/reference/modules/GameText.html +701 -0
- package/public/docs/reference/modules/GameTime.html +696 -0
- package/public/docs/reference/modules/HudRenderer.html +568 -0
- package/public/docs/reference/modules/InitialStateSnapshot.html +557 -0
- package/public/docs/reference/modules/SessionModal.html +520 -0
- package/public/docs/reference/types/Axis.html +505 -0
- package/public/docs/reference/types/Cell.html +514 -0
- package/public/docs/reference/types/ControlCallback.html +488 -0
- package/public/docs/reference/types/Coordinate.html +510 -0
- package/public/docs/reference/types/GameEntry.html +514 -0
- package/public/docs/reference/types/GameEvent.html +514 -0
- package/public/docs/reference/types/Piece.html +506 -0
- package/public/docs/reference/types/RendererMetrics.html +514 -0
- package/public/docs/reference/types/Vector.html +509 -0
- package/public/docs/testing_best_practices.html +770 -0
- package/public/favicon.ico +0 -0
- package/public/fonts/digital-7.monoitalic.ttf +0 -0
- package/public/images/cell.svg +32 -0
- package/public/images/close.png +0 -0
- package/public/images/games.png +0 -0
- package/public/images/github.png +0 -0
- package/public/images/letter-a.png +0 -0
- package/public/images/letter-d.png +0 -0
- package/public/images/letter-j.png +0 -0
- package/public/images/letter-s.png +0 -0
- package/public/images/letter-w.png +0 -0
- package/public/images/meta-image.png +0 -0
- package/public/images/number-1.png +0 -0
- package/public/images/number-2.png +0 -0
- package/public/images/number-3.png +0 -0
- package/public/images/number-4.png +0 -0
- package/public/images/number-5.png +0 -0
- package/public/images/number-6.png +0 -0
- package/public/images/splash.gif +0 -0
- package/public/index.html +15 -0
- package/public/sounds/sound_00.wav +0 -0
- package/public/sounds/sound_01.wav +0 -0
- package/public/sounds/sound_02.wav +0 -0
- package/public/sounds/sound_03.wav +0 -0
- package/public/sounds/sound_04.wav +0 -0
- package/public/sounds/sound_05.wav +0 -0
- package/public/sounds/sound_06.wav +0 -0
- package/public/sounds/sound_07.wav +0 -0
- package/public/sounds/sound_08.wav +0 -0
- package/public/sounds/sound_09.wav +0 -0
- package/public/sounds/sound_10.wav +0 -0
- package/public/sounds/sound_11.wav +0 -0
- package/public/sounds/sound_12.wav +0 -0
- package/public/sounds/sound_13.wav +0 -0
- package/public/sounds/sound_14.wav +0 -0
- package/public/sounds/sound_15.wav +0 -0
- package/public/style/body.css +86 -0
- package/public/style/buttons.css +233 -0
- package/public/style/debugger.css +117 -0
- package/public/style/sessionModal.css +155 -0
- package/public/style/sourceCodeAndCommands.css +74 -0
- package/public/style/splash.css +13 -0
- package/public/style/theme.css +137 -0
- package/scripts/generate-diagrams.sh +20 -0
- package/scripts/generate-docs.js +111 -0
- package/src/client-game.d.ts +1 -0
- package/src/config/configs.test.ts +20 -0
- package/src/config/configs.ts +197 -0
- package/src/config/env.test.ts +59 -0
- package/src/config/env.ts +7 -0
- package/src/config/styles.ts +5 -0
- package/src/core/Game.test.ts +167 -0
- package/src/core/Game.ts +307 -0
- package/src/core/InitialStateSnapshot.test.ts +51 -0
- package/src/core/InitialStateSnapshot.ts +46 -0
- package/src/core/helpers/CellHelper.test.ts +33 -0
- package/src/core/helpers/CellHelper.ts +21 -0
- package/src/core/helpers/ControlInputHandlerHelper.test.ts +116 -0
- package/src/core/helpers/ControlInputHandlerHelper.ts +68 -0
- package/src/core/helpers/CoordinateHelper.test.ts +113 -0
- package/src/core/helpers/CoordinateHelper.ts +82 -0
- package/src/core/helpers/InterfaceIdentifierHelper.test.ts +122 -0
- package/src/core/helpers/InterfaceIdentifierHelper.ts +43 -0
- package/src/core/helpers/RelativeValuesHelper.test.ts +47 -0
- package/src/core/helpers/RelativeValuesHelper.ts +29 -0
- package/src/core/module/control/GameControl.test.ts +82 -0
- package/src/core/module/control/GameControl.ts +142 -0
- package/src/core/module/control/GameControlKeyBinding.test.ts +59 -0
- package/src/core/module/control/GameControlKeyBinding.ts +92 -0
- package/src/core/module/grid/GameGrid.test.ts +83 -0
- package/src/core/module/grid/GameGrid.ts +610 -0
- package/src/core/module/grid/GameHudGrid.test.ts +22 -0
- package/src/core/module/grid/GameHudGrid.ts +40 -0
- package/src/core/module/grid/engines/GridAnalysisEngine.test.ts +157 -0
- package/src/core/module/grid/engines/GridAnalysisEngine.ts +124 -0
- package/src/core/module/grid/engines/GridLineEngine.test.ts +132 -0
- package/src/core/module/grid/engines/GridLineEngine.ts +165 -0
- package/src/core/module/grid/engines/GridMovementEngine.test.ts +125 -0
- package/src/core/module/grid/engines/GridMovementEngine.ts +113 -0
- package/src/core/module/grid/engines/GridRegionEngine.test.ts +136 -0
- package/src/core/module/grid/engines/GridRegionEngine.ts +52 -0
- package/src/core/module/grid/engines/GridTransformEngine.test.ts +98 -0
- package/src/core/module/grid/engines/GridTransformEngine.ts +70 -0
- package/src/core/module/renderer/DisplayRenderer.test.ts +86 -0
- package/src/core/module/renderer/DisplayRenderer.ts +152 -0
- package/src/core/module/renderer/GameRenderer.test.ts +103 -0
- package/src/core/module/renderer/GameRenderer.ts +144 -0
- package/src/core/module/renderer/HudRenderer.test.ts +108 -0
- package/src/core/module/renderer/HudRenderer.ts +203 -0
- package/src/core/module/score/GameScore.test.ts +71 -0
- package/src/core/module/score/GameScore.ts +188 -0
- package/src/core/module/session/GameSession.test.ts +176 -0
- package/src/core/module/session/GameSession.ts +103 -0
- package/src/core/module/sound/GameSound.test.ts +117 -0
- package/src/core/module/sound/GameSound.ts +229 -0
- package/src/core/module/state/GameState.test.ts +101 -0
- package/src/core/module/state/GameState.ts +339 -0
- package/src/core/module/text/GameText.test.ts +87 -0
- package/src/core/module/text/GameText.ts +150 -0
- package/src/core/module/time/GameTime.test.ts +86 -0
- package/src/core/module/time/GameTime.ts +144 -0
- package/src/core/types/Interfaces.ts +59 -0
- package/src/core/types/Types.ts +124 -0
- package/src/core/types/enums.ts +113 -0
- package/src/core/types/modules.ts +841 -0
- package/src/index.test.ts +15 -0
- package/src/index.ts +9 -0
- package/src/main.test.ts +137 -0
- package/src/main.ts +77 -0
- package/src/menu/GameMenu.test.ts +157 -0
- package/src/menu/GameMenu.ts +124 -0
- package/src/menu/GameMenuSingleton.test.ts +26 -0
- package/src/menu/GameMenuSingleton.ts +13 -0
- package/src/menu/GameRepository.test.ts +46 -0
- package/src/menu/GameRepository.ts +47 -0
- package/src/menu/manager/GameManager.test.ts +68 -0
- package/src/menu/manager/GameManager.ts +50 -0
- package/src/types/global.d.ts +8 -0
- package/src/types/interfaces.ts +5 -0
- package/src/view/Debugger.test.ts +152 -0
- package/src/view/Debugger.ts +124 -0
- package/src/view/GameView.test.ts +95 -0
- package/src/view/GameView.ts +244 -0
- package/src/view/SessionModal.test.ts +141 -0
- package/src/view/SessionModal.ts +73 -0
- package/src/view/components/layout/ButtonLayout.test.ts +28 -0
- package/src/view/components/layout/ButtonLayout.ts +63 -0
- package/src/view/components/layout/ContainerLayout.test.ts +48 -0
- package/src/view/components/layout/ContainerLayout.ts +50 -0
- package/src/view/components/layout/FrameLayout.test.ts +24 -0
- package/src/view/components/layout/FrameLayout.ts +25 -0
- package/src/view/components/ui/BigButton.test.ts +28 -0
- package/src/view/components/ui/BigButton.ts +31 -0
- package/src/view/components/ui/Button.test.ts +30 -0
- package/src/view/components/ui/Button.ts +30 -0
- package/src/view/components/ui/Canvas.test.ts +32 -0
- package/src/view/components/ui/Canvas.ts +34 -0
- package/src/view/components/ui/SmallButton.test.ts +48 -0
- package/src/view/components/ui/SmallButton.ts +32 -0
- package/src/view/theme/applyColors.test.ts +47 -0
- package/src/view/theme/applyColors.ts +38 -0
- package/src/view/theme/dimensions.test.ts +34 -0
- package/src/view/theme/dimensions.ts +53 -0
- package/tsconfig.json +16 -0
- package/vitest.config.ts +14 -0
- package/webpack.config.js +133 -0
|
@@ -0,0 +1,794 @@
|
|
|
1
|
+
= GameGrid Module Reference
|
|
2
|
+
:description: Manages the state of a 2D grid for cell manipulation and collision detection.
|
|
3
|
+
:keywords: grid, cells, logic, collision
|
|
4
|
+
:toc: left
|
|
5
|
+
:toclevels: 3
|
|
6
|
+
:sectnums:
|
|
7
|
+
:sectlinks:
|
|
8
|
+
:icons: font
|
|
9
|
+
:source-highlighter: highlight.js
|
|
10
|
+
:reproducible:
|
|
11
|
+
:experimental:
|
|
12
|
+
:idprefix:
|
|
13
|
+
:idseparator: -
|
|
14
|
+
|
|
15
|
+
The `GameGrid` module manages the state of a 2D grid, providing a robust API for cell manipulation, row/column operations, and collision detection.
|
|
16
|
+
|
|
17
|
+
== Specialized Instances
|
|
18
|
+
|
|
19
|
+
The engine provides two main grid instances:
|
|
20
|
+
* `modules.grid`: The main game display area (dimensions defined in `configs`).
|
|
21
|
+
* `modules.hudGrid`: A specialized 4x4 grid used for HUD elements (e.g., "Next Piece" in Tetris).
|
|
22
|
+
|
|
23
|
+
== API Reference
|
|
24
|
+
|
|
25
|
+
=== Core & Utilities
|
|
26
|
+
|
|
27
|
+
Fundamental methods for grid initialization, basic cell access, and iteration. These methods form the backbone of grid state management.
|
|
28
|
+
|
|
29
|
+
==== `width: number`
|
|
30
|
+
|
|
31
|
+
Read-only property returning the number of columns in the grid.
|
|
32
|
+
|
|
33
|
+
**Returns**
|
|
34
|
+
|
|
35
|
+
`number` - Grid width.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
'''
|
|
39
|
+
|
|
40
|
+
==== `height: number`
|
|
41
|
+
|
|
42
|
+
Read-only property returning the number of rows in the grid.
|
|
43
|
+
|
|
44
|
+
**Returns**
|
|
45
|
+
|
|
46
|
+
`number` - Grid height.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
'''
|
|
50
|
+
|
|
51
|
+
==== `resetGrid(): void`
|
|
52
|
+
|
|
53
|
+
Resets the entire grid to its empty state.
|
|
54
|
+
|
|
55
|
+
**Behavior**
|
|
56
|
+
|
|
57
|
+
Clears all cells and populates them with default empty cell objects using dimensions from the engine configuration.
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
'''
|
|
61
|
+
|
|
62
|
+
==== `getGrid(): xref:../types/Cell.adoc[Cell][][]`
|
|
63
|
+
|
|
64
|
+
Returns the underlying 2D array of cells.
|
|
65
|
+
|
|
66
|
+
**Returns**
|
|
67
|
+
|
|
68
|
+
`xref:../types/Cell.adoc[Cell][][]` - The matrix representing the grid state.
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
'''
|
|
72
|
+
|
|
73
|
+
==== `forEach(callback: (cell: xref:../types/Cell.adoc[Cell]) => void): void`
|
|
74
|
+
|
|
75
|
+
Iterates over every cell and executes the provided callback.
|
|
76
|
+
|
|
77
|
+
**Parameters**
|
|
78
|
+
|
|
79
|
+
[cols="1,1,3"]
|
|
80
|
+
|===
|
|
81
|
+
|Name |Type |Description
|
|
82
|
+
|`callback` |`(cell: xref:../types/Cell.adoc[Cell]) => void` |Function to execute for each cell.
|
|
83
|
+
|===
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
'''
|
|
87
|
+
|
|
88
|
+
==== `isValidCoordinate(coordinate: xref:../types/Coordinate.adoc[Coordinate]): boolean`
|
|
89
|
+
|
|
90
|
+
Verifies if a coordinate is within the current grid boundaries.
|
|
91
|
+
|
|
92
|
+
**Parameters**
|
|
93
|
+
|
|
94
|
+
[cols="1,1,3"]
|
|
95
|
+
|===
|
|
96
|
+
|Name |Type |Description
|
|
97
|
+
|`coordinate` |`xref:../types/Coordinate.adoc[Coordinate]` |The `{x, y}` point to validate.
|
|
98
|
+
|===
|
|
99
|
+
|
|
100
|
+
**Returns**
|
|
101
|
+
|
|
102
|
+
`boolean` - `true` if valid, `false` otherwise.
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
'''
|
|
106
|
+
|
|
107
|
+
==== `getCell(coordinate: xref:../types/Coordinate.adoc[Coordinate]): xref:../types/Cell.adoc[Cell] | null`
|
|
108
|
+
|
|
109
|
+
Retrieves a cell at a specific coordinate.
|
|
110
|
+
|
|
111
|
+
**Parameters**
|
|
112
|
+
|
|
113
|
+
[cols="1,1,3"]
|
|
114
|
+
|===
|
|
115
|
+
|Name |Type |Description
|
|
116
|
+
|`coordinate` |`xref:../types/Coordinate.adoc[Coordinate]` |The `{x, y}` position to query.
|
|
117
|
+
|===
|
|
118
|
+
|
|
119
|
+
**Returns**
|
|
120
|
+
|
|
121
|
+
`xref:../types/Cell.adoc[Cell] | null` - The cell object, or `null` if the coordinate is out of bounds.
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
'''
|
|
125
|
+
|
|
126
|
+
==== `setCellValue(coordinate: xref:../types/Coordinate.adoc[Coordinate], value: number): void`
|
|
127
|
+
|
|
128
|
+
Updates the numeric value of a cell.
|
|
129
|
+
|
|
130
|
+
**Parameters**
|
|
131
|
+
|
|
132
|
+
[cols="1,1,3"]
|
|
133
|
+
|===
|
|
134
|
+
|Name |Type |Description
|
|
135
|
+
|`coordinate` |`xref:../types/Coordinate.adoc[Coordinate]` |Target position.
|
|
136
|
+
|`value` |`number` |New status value (0 for inactive, >0 for active).
|
|
137
|
+
|===
|
|
138
|
+
|
|
139
|
+
**Behavior**
|
|
140
|
+
|
|
141
|
+
Updates the `value` property of the cell. If the coordinate is invalid, the operation is ignored.
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
'''
|
|
145
|
+
|
|
146
|
+
==== `setCellColor(coordinate: xref:../types/Coordinate.adoc[Coordinate], color: xref:../enums/Color.adoc[Color]): void`
|
|
147
|
+
|
|
148
|
+
Updates the color of a cell.
|
|
149
|
+
|
|
150
|
+
**Parameters**
|
|
151
|
+
|
|
152
|
+
[cols="1,1,3"]
|
|
153
|
+
|===
|
|
154
|
+
|Name |Type |Description
|
|
155
|
+
|`coordinate` |`xref:../types/Coordinate.adoc[Coordinate]` |Target position.
|
|
156
|
+
|`color` |`xref:../enums/Color.adoc[Color]` |Enum value representing the new color.
|
|
157
|
+
|===
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
'''
|
|
161
|
+
|
|
162
|
+
==== `isCellActive(coordinate: xref:../types/Coordinate.adoc[Coordinate]): boolean`
|
|
163
|
+
|
|
164
|
+
Checks if a cell is currently occupied.
|
|
165
|
+
|
|
166
|
+
**Parameters**
|
|
167
|
+
|
|
168
|
+
[cols="1,1,3"]
|
|
169
|
+
|===
|
|
170
|
+
|Name |Type |Description
|
|
171
|
+
|`coordinate` |`xref:../types/Coordinate.adoc[Coordinate]` |Point to check.
|
|
172
|
+
|===
|
|
173
|
+
|
|
174
|
+
**Returns**
|
|
175
|
+
|
|
176
|
+
`boolean` - `true` if the cell value is greater than 0.
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
'''
|
|
180
|
+
|
|
181
|
+
==== `isCellInactive(coordinate: xref:../types/Coordinate.adoc[Coordinate]): boolean`
|
|
182
|
+
|
|
183
|
+
Checks if a cell is currently empty.
|
|
184
|
+
|
|
185
|
+
**Parameters**
|
|
186
|
+
|
|
187
|
+
[cols="1,1,3"]
|
|
188
|
+
|===
|
|
189
|
+
|Name |Type |Description
|
|
190
|
+
|`coordinate` |`xref:../types/Coordinate.adoc[Coordinate]` |Point to check.
|
|
191
|
+
|===
|
|
192
|
+
|
|
193
|
+
**Returns**
|
|
194
|
+
|
|
195
|
+
`boolean` - `true` if the cell value is exactly 0.
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
'''
|
|
199
|
+
|
|
200
|
+
==== `getDebugData(): Record<string, string | number | boolean>`
|
|
201
|
+
|
|
202
|
+
Returns metadata for the real-time debugger.
|
|
203
|
+
|
|
204
|
+
**Returns**
|
|
205
|
+
|
|
206
|
+
`Record<string, string | number | boolean>` - Object containing `width`, `height`, and `activeCells` count.
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
'''
|
|
210
|
+
|
|
211
|
+
=== Line & Column Management
|
|
212
|
+
|
|
213
|
+
Methods for managing entire lines (rows) or columns. These are essential for mechanics like clearing full lines in Tetris-style games or shifting grid content as a single block.
|
|
214
|
+
|
|
215
|
+
==== `isRowFull(y: number): boolean`
|
|
216
|
+
|
|
217
|
+
Checks if a specific row has no empty cells.
|
|
218
|
+
|
|
219
|
+
**Parameters**
|
|
220
|
+
|
|
221
|
+
[cols="1,1,3"]
|
|
222
|
+
|===
|
|
223
|
+
|Name |Type |Description
|
|
224
|
+
|`y` |`number` |Row index to check.
|
|
225
|
+
|===
|
|
226
|
+
|
|
227
|
+
**Returns**
|
|
228
|
+
|
|
229
|
+
`boolean` - `true` if all cells in the row are active.
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
'''
|
|
233
|
+
|
|
234
|
+
==== `isRowEmpty(y: number): boolean`
|
|
235
|
+
|
|
236
|
+
Checks if a specific row is completely empty.
|
|
237
|
+
|
|
238
|
+
**Parameters**
|
|
239
|
+
|
|
240
|
+
[cols="1,1,3"]
|
|
241
|
+
|===
|
|
242
|
+
|Name |Type |Description
|
|
243
|
+
|`y` |`number` |Row index to check.
|
|
244
|
+
|===
|
|
245
|
+
|
|
246
|
+
**Returns**
|
|
247
|
+
|
|
248
|
+
`boolean` - `true` if all cells in the row are inactive.
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
'''
|
|
252
|
+
|
|
253
|
+
==== `clearRow(y: number): void`
|
|
254
|
+
|
|
255
|
+
Resets all cells in a row to the empty state.
|
|
256
|
+
|
|
257
|
+
**Parameters**
|
|
258
|
+
|
|
259
|
+
[cols="1,1,3"]
|
|
260
|
+
|===
|
|
261
|
+
|Name |Type |Description
|
|
262
|
+
|`y` |`number` |Row index to clear.
|
|
263
|
+
|===
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
'''
|
|
267
|
+
|
|
268
|
+
==== `shiftRowsDown(fromY: number): void`
|
|
269
|
+
|
|
270
|
+
Shifts all rows above an index down by one position.
|
|
271
|
+
|
|
272
|
+
**Parameters**
|
|
273
|
+
|
|
274
|
+
[cols="1,1,3"]
|
|
275
|
+
|===
|
|
276
|
+
|Name |Type |Description
|
|
277
|
+
|`fromY` |`number` |The row index to start shifting from.
|
|
278
|
+
|===
|
|
279
|
+
|
|
280
|
+
**Behavior**
|
|
281
|
+
|
|
282
|
+
Moves row `y-1` to `y` for all rows up to `fromY`. The top-most row (index 0) is cleared after the shift.
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
'''
|
|
286
|
+
|
|
287
|
+
==== `shiftRowsUp(fromY: number): void`
|
|
288
|
+
|
|
289
|
+
Shifts all rows below an index up by one position.
|
|
290
|
+
|
|
291
|
+
**Parameters**
|
|
292
|
+
|
|
293
|
+
[cols="1,1,3"]
|
|
294
|
+
|===
|
|
295
|
+
|Name |Type |Description
|
|
296
|
+
|`fromY` |`number` |The row index to start shifting from.
|
|
297
|
+
|===
|
|
298
|
+
|
|
299
|
+
**Behavior**
|
|
300
|
+
|
|
301
|
+
Moves row `y+1` to `y` for all rows starting from `fromY` downwards. The bottom-most row is cleared after the shift.
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
'''
|
|
305
|
+
|
|
306
|
+
==== `clearFullRows(): number`
|
|
307
|
+
|
|
308
|
+
Scans for, clears, and collapses full rows.
|
|
309
|
+
|
|
310
|
+
**Returns**
|
|
311
|
+
|
|
312
|
+
`number` - The total count of rows cleared.
|
|
313
|
+
|
|
314
|
+
**Behavior**
|
|
315
|
+
|
|
316
|
+
Iterates through all rows. If a row is full, it is cleared, and all rows above it are shifted down.
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
'''
|
|
320
|
+
|
|
321
|
+
==== `isColumnFull(x: number): boolean`
|
|
322
|
+
|
|
323
|
+
Checks if a specific column has no empty cells.
|
|
324
|
+
|
|
325
|
+
**Parameters**
|
|
326
|
+
|
|
327
|
+
[cols="1,1,3"]
|
|
328
|
+
|===
|
|
329
|
+
|Name |Type |Description
|
|
330
|
+
|`x` |`number` |Column index to check.
|
|
331
|
+
|===
|
|
332
|
+
|
|
333
|
+
**Returns**
|
|
334
|
+
|
|
335
|
+
`boolean` - `true` if full.
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
'''
|
|
339
|
+
|
|
340
|
+
==== `isColumnEmpty(x: number): boolean`
|
|
341
|
+
|
|
342
|
+
Checks if a specific column is completely empty.
|
|
343
|
+
|
|
344
|
+
**Parameters**
|
|
345
|
+
|
|
346
|
+
[cols="1,1,3"]
|
|
347
|
+
|===
|
|
348
|
+
|Name |Type |Description
|
|
349
|
+
|`x` |`number` |Column index to check.
|
|
350
|
+
|===
|
|
351
|
+
|
|
352
|
+
**Returns**
|
|
353
|
+
|
|
354
|
+
`boolean` - `true` if empty.
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
'''
|
|
358
|
+
|
|
359
|
+
==== `clearColumn(x: number): void`
|
|
360
|
+
|
|
361
|
+
Resets all cells in a column to the empty state.
|
|
362
|
+
|
|
363
|
+
**Parameters**
|
|
364
|
+
|
|
365
|
+
[cols="1,1,3"]
|
|
366
|
+
|===
|
|
367
|
+
|Name |Type |Description
|
|
368
|
+
|`x` |`number` |Column index to clear.
|
|
369
|
+
|===
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
'''
|
|
373
|
+
|
|
374
|
+
==== `shiftColumnsRight(fromX: number): void`
|
|
375
|
+
|
|
376
|
+
Shifts all columns to the right of an index.
|
|
377
|
+
|
|
378
|
+
**Parameters**
|
|
379
|
+
|
|
380
|
+
[cols="1,1,3"]
|
|
381
|
+
|===
|
|
382
|
+
|Name |Type |Description
|
|
383
|
+
|`fromX` |`number` |The column index to start shifting from.
|
|
384
|
+
|===
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
'''
|
|
388
|
+
|
|
389
|
+
==== `shiftColumnsLeft(fromX: number): void`
|
|
390
|
+
|
|
391
|
+
Shifts all columns to the left of an index.
|
|
392
|
+
|
|
393
|
+
**Parameters**
|
|
394
|
+
|
|
395
|
+
[cols="1,1,3"]
|
|
396
|
+
|===
|
|
397
|
+
|Name |Type |Description
|
|
398
|
+
|`fromX` |`number` |The column index to start shifting from.
|
|
399
|
+
|===
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
'''
|
|
403
|
+
|
|
404
|
+
==== `clearFullColumns(): number`
|
|
405
|
+
|
|
406
|
+
Detects and clears all full columns.
|
|
407
|
+
|
|
408
|
+
**Returns**
|
|
409
|
+
|
|
410
|
+
`number` - The total count of cleared columns.
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
'''
|
|
414
|
+
|
|
415
|
+
=== Region & Area Management
|
|
416
|
+
|
|
417
|
+
Operations for handling multi-cell areas, rectangular regions, and piece shapes. These methods facilitate the logical placement and validation of game objects within the grid.
|
|
418
|
+
|
|
419
|
+
==== `isAreaOccupied(coordinates: xref:../types/Coordinate.adoc[Coordinate][]): boolean`
|
|
420
|
+
|
|
421
|
+
Checks for collisions between a list of coordinates and active cells in the grid.
|
|
422
|
+
|
|
423
|
+
**Parameters**
|
|
424
|
+
|
|
425
|
+
[cols="1,1,3"]
|
|
426
|
+
|===
|
|
427
|
+
|Name |Type |Description
|
|
428
|
+
|`coordinates` |`xref:../types/Coordinate.adoc[Coordinate][]` |Array of `{x, y}` points representing a shape or piece.
|
|
429
|
+
|===
|
|
430
|
+
|
|
431
|
+
**Returns**
|
|
432
|
+
|
|
433
|
+
`boolean` - `true` if any coordinate is either out of bounds or already occupied (active).
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
'''
|
|
437
|
+
|
|
438
|
+
==== `fillArea(start: xref:../types/Coordinate.adoc[Coordinate], end: xref:../types/Coordinate.adoc[Coordinate], value: number, color: xref:../enums/Color.adoc[Color]): void`
|
|
439
|
+
|
|
440
|
+
Fills a rectangular area with specified properties.
|
|
441
|
+
|
|
442
|
+
**Parameters**
|
|
443
|
+
|
|
444
|
+
[cols="1,1,3"]
|
|
445
|
+
|===
|
|
446
|
+
|Name |Type |Description
|
|
447
|
+
|`start` |`xref:../types/Coordinate.adoc[Coordinate]` |Top-left corner of the rectangle.
|
|
448
|
+
|`end` |`xref:../types/Coordinate.adoc[Coordinate]` |Bottom-right corner of the rectangle.
|
|
449
|
+
|`value` |`number` |Value to apply to all cells in the area.
|
|
450
|
+
|`color` |`xref:../enums/Color.adoc[Color]` |Color to apply to all cells in the area.
|
|
451
|
+
|===
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
'''
|
|
455
|
+
|
|
456
|
+
==== `stampPiece(piece: xref:../types/Piece.adoc[Piece]): void`
|
|
457
|
+
|
|
458
|
+
Updates multiple specific coordinates simultaneously with their specific values and colors.
|
|
459
|
+
|
|
460
|
+
**Parameters**
|
|
461
|
+
|
|
462
|
+
[cols="1,1,3"]
|
|
463
|
+
|===
|
|
464
|
+
|Name |Type |Description
|
|
465
|
+
|`piece` |`xref:../types/Piece.adoc[Piece]` |The collection of cells to stamp.
|
|
466
|
+
|===
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
'''
|
|
470
|
+
|
|
471
|
+
==== `stampCell(cell: xref:../types/Cell.adoc[Cell]): void`
|
|
472
|
+
|
|
473
|
+
Updates a single coordinate with a specific value and color from a Cell.
|
|
474
|
+
|
|
475
|
+
**Parameters**
|
|
476
|
+
|
|
477
|
+
[cols="1,1,3"]
|
|
478
|
+
|===
|
|
479
|
+
|Name |Type |Description
|
|
480
|
+
|`cell` |`xref:../types/Cell.adoc[Cell]` |The cell object containing the target coordinate, value, and color.
|
|
481
|
+
|===
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
'''
|
|
485
|
+
|
|
486
|
+
=== Movement & Projections
|
|
487
|
+
|
|
488
|
+
Advanced methods for handling piece and cell movement with built-in collision detection and trajectory prediction.
|
|
489
|
+
|
|
490
|
+
==== `movePiece(piece: xref:../types/Piece.adoc[Piece], direction: xref:../types/Vector.adoc[Vector]): xref:../types/Piece.adoc[Piece] | null`
|
|
491
|
+
|
|
492
|
+
Attempts to shift a collection of cells (a piece) in a specified direction.
|
|
493
|
+
|
|
494
|
+
**Parameters**
|
|
495
|
+
|
|
496
|
+
[cols="1,1,3"]
|
|
497
|
+
|===
|
|
498
|
+
|Name |Type |Description
|
|
499
|
+
|`piece` |`xref:../types/Piece.adoc[Piece]` |The current collection of cells.
|
|
500
|
+
|`direction` |`xref:../types/Vector.adoc[Vector]` |The movement vector (e.g., `{x: -1, y: 0}`).
|
|
501
|
+
|===
|
|
502
|
+
|
|
503
|
+
**Returns**
|
|
504
|
+
|
|
505
|
+
`xref:../types/Piece.adoc[Piece] | null` - The new piece with updated coordinates if the move is valid, or `null` if blocked.
|
|
506
|
+
|
|
507
|
+
**Behavior**
|
|
508
|
+
|
|
509
|
+
Validates that all new positions are within grid boundaries and are not occupied by other active cells. Cells that are already part of the input `piece` are ignored during collision detection to allow a piece to move "into its own space."
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
'''
|
|
513
|
+
|
|
514
|
+
==== `movePieceLeft(piece: xref:../types/Piece.adoc[Piece]): xref:../types/Piece.adoc[Piece] | null`
|
|
515
|
+
|
|
516
|
+
Alias for `movePiece` shifting one unit to the left.
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
'''
|
|
520
|
+
|
|
521
|
+
==== `movePieceRight(piece: xref:../types/Piece.adoc[Piece]): xref:../types/Piece.adoc[Piece] | null`
|
|
522
|
+
|
|
523
|
+
Alias for `movePiece` shifting one unit to the right.
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
'''
|
|
527
|
+
|
|
528
|
+
==== `movePieceUp(piece: xref:../types/Piece.adoc[Piece]): xref:../types/Piece.adoc[Piece] | null`
|
|
529
|
+
|
|
530
|
+
Alias for `movePiece` shifting one unit up.
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
'''
|
|
534
|
+
|
|
535
|
+
==== `movePieceDown(piece: xref:../types/Piece.adoc[Piece]): xref:../types/Piece.adoc[Piece] | null`
|
|
536
|
+
|
|
537
|
+
Alias for `movePiece` shifting one unit down.
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
'''
|
|
541
|
+
|
|
542
|
+
==== `moveCell(cell: xref:../types/Cell.adoc[Cell], direction: xref:../types/Vector.adoc[Vector]): xref:../types/Cell.adoc[Cell] | null`
|
|
543
|
+
|
|
544
|
+
Attempts to shift a single cell in a specified direction.
|
|
545
|
+
|
|
546
|
+
**Parameters**
|
|
547
|
+
|
|
548
|
+
[cols="1,1,3"]
|
|
549
|
+
|===
|
|
550
|
+
|Name |Type |Description
|
|
551
|
+
|`cell` |`xref:../types/Cell.adoc[Cell]` |The current cell.
|
|
552
|
+
|`direction` |`xref:../types/Vector.adoc[Vector]` |The movement vector.
|
|
553
|
+
|===
|
|
554
|
+
|
|
555
|
+
**Returns**
|
|
556
|
+
|
|
557
|
+
`xref:../types/Cell.adoc[Cell] | null` - The new cell with updated coordinate if the move is valid, or `null` if blocked.
|
|
558
|
+
|
|
559
|
+
**Behavior**
|
|
560
|
+
|
|
561
|
+
Validates that the target position is within grid boundaries and is currently empty (inactive).
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
'''
|
|
565
|
+
|
|
566
|
+
==== `moveCellLeft(cell: xref:../types/Cell.adoc[Cell]): xref:../types/Cell.adoc[Cell] | null`
|
|
567
|
+
|
|
568
|
+
Alias for `moveCell` shifting one unit to the left.
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
'''
|
|
572
|
+
|
|
573
|
+
==== `moveCellRight(cell: xref:../types/Cell.adoc[Cell]): xref:../types/Cell.adoc[Cell] | null`
|
|
574
|
+
|
|
575
|
+
Alias for `moveCell` shifting one unit to the right.
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
'''
|
|
579
|
+
|
|
580
|
+
==== `moveCellUp(cell: xref:../types/Cell.adoc[Cell]): xref:../types/Cell.adoc[Cell] | null`
|
|
581
|
+
|
|
582
|
+
Alias for `moveCell` shifting one unit up.
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
'''
|
|
586
|
+
|
|
587
|
+
==== `moveCellDown(cell: xref:../types/Cell.adoc[Cell]): xref:../types/Cell.adoc[Cell] | null`
|
|
588
|
+
|
|
589
|
+
Alias for `moveCell` shifting one unit down.
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
'''
|
|
593
|
+
|
|
594
|
+
==== `getDropPath(piece: xref:../types/Piece.adoc[Piece]): xref:../types/Piece.adoc[Piece]`
|
|
595
|
+
|
|
596
|
+
Calculates the final vertical resting position of a piece if it were dropped continuously downwards.
|
|
597
|
+
|
|
598
|
+
**Parameters**
|
|
599
|
+
|
|
600
|
+
[cols="1,1,3"]
|
|
601
|
+
|===
|
|
602
|
+
|Name |Type |Description
|
|
603
|
+
|`piece` |`xref:../types/Piece.adoc[Piece]` |The piece to project.
|
|
604
|
+
|===
|
|
605
|
+
|
|
606
|
+
**Returns**
|
|
607
|
+
|
|
608
|
+
`xref:../types/Piece.adoc[Piece]` - A new piece representing the final resting position. Useful for rendering "ghost" or "preview" pieces.
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
'''
|
|
612
|
+
|
|
613
|
+
==== `getRisePath(piece: xref:../types/Piece.adoc[Piece]): xref:../types/Piece.adoc[Piece]`
|
|
614
|
+
|
|
615
|
+
Calculates the final vertical resting position of a piece if it were moved continuously upwards.
|
|
616
|
+
|
|
617
|
+
**Parameters**
|
|
618
|
+
|
|
619
|
+
[cols="1,1,3"]
|
|
620
|
+
|===
|
|
621
|
+
|Name |Type |Description
|
|
622
|
+
|`piece` |`xref:../types/Piece.adoc[Piece]` |The piece to project.
|
|
623
|
+
|===
|
|
624
|
+
|
|
625
|
+
**Returns**
|
|
626
|
+
|
|
627
|
+
`xref:../types/Piece.adoc[Piece]` - A new piece representing the highest resting position.
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
'''
|
|
631
|
+
|
|
632
|
+
==== `getReachPathLeft(piece: xref:../types/Piece.adoc[Piece]): xref:../types/Piece.adoc[Piece]`
|
|
633
|
+
|
|
634
|
+
Calculates the final horizontal resting position of a piece if it were moved continuously to the left.
|
|
635
|
+
|
|
636
|
+
**Parameters**
|
|
637
|
+
|
|
638
|
+
[cols="1,1,3"]
|
|
639
|
+
|===
|
|
640
|
+
|Name |Type |Description
|
|
641
|
+
|`piece` |`xref:../types/Piece.adoc[Piece]` |The piece to project.
|
|
642
|
+
|===
|
|
643
|
+
|
|
644
|
+
**Returns**
|
|
645
|
+
|
|
646
|
+
`xref:../types/Piece.adoc[Piece]` - A new piece representing the leftmost resting position.
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
'''
|
|
650
|
+
|
|
651
|
+
==== `getReachPathRight(piece: xref:../types/Piece.adoc[Piece]): xref:../types/Piece.adoc[Piece]`
|
|
652
|
+
|
|
653
|
+
Calculates the final horizontal resting position of a piece if it were moved continuously to the right.
|
|
654
|
+
|
|
655
|
+
**Parameters**
|
|
656
|
+
|
|
657
|
+
[cols="1,1,3"]
|
|
658
|
+
|===
|
|
659
|
+
|Name |Type |Description
|
|
660
|
+
|`piece` |`xref:../types/Piece.adoc[Piece]` |The piece to project.
|
|
661
|
+
|===
|
|
662
|
+
|
|
663
|
+
**Returns**
|
|
664
|
+
|
|
665
|
+
`xref:../types/Piece.adoc[Piece]` - A new piece representing the rightmost resting position.
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
'''
|
|
669
|
+
|
|
670
|
+
=== Transformations
|
|
671
|
+
|
|
672
|
+
Geometric operations for rotating or mirroring complex shapes within the grid boundaries.
|
|
673
|
+
|
|
674
|
+
==== `rotatePiece(piece: xref:../types/Piece.adoc[Piece], origin: xref:../types/Coordinate.adoc[Coordinate], clockwise: boolean = true): xref:../types/Piece.adoc[Piece] | null`
|
|
675
|
+
|
|
676
|
+
Attempts to rotate a collection of cells 90 degrees around a specific origin point.
|
|
677
|
+
|
|
678
|
+
**Parameters**
|
|
679
|
+
|
|
680
|
+
[cols="1,1,3"]
|
|
681
|
+
|===
|
|
682
|
+
|Name |Type |Description
|
|
683
|
+
|`piece` |`xref:../types/Piece.adoc[Piece]` |The piece to rotate.
|
|
684
|
+
|`origin` |`xref:../types/Coordinate.adoc[Coordinate]` |The pivot point for rotation.
|
|
685
|
+
|`clockwise` |`boolean` |If true, rotates 90° clockwise; otherwise, 90° counter-clockwise.
|
|
686
|
+
|===
|
|
687
|
+
|
|
688
|
+
**Returns**
|
|
689
|
+
|
|
690
|
+
`xref:../types/Piece.adoc[Piece] | null` - The new piece if rotation is valid (no collisions), or `null` if blocked.
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
'''
|
|
694
|
+
|
|
695
|
+
==== `mirrorPiece(piece: xref:../types/Piece.adoc[Piece], axis: xref:../types/Axis.adoc[Axis]): xref:../types/Piece.adoc[Piece]`
|
|
696
|
+
|
|
697
|
+
Mirrors a piece across its own center on a specific axis.
|
|
698
|
+
|
|
699
|
+
**Parameters**
|
|
700
|
+
|
|
701
|
+
[cols="1,1,3"]
|
|
702
|
+
|===
|
|
703
|
+
|Name |Type |Description
|
|
704
|
+
|`piece` |`xref:../types/Piece.adoc[Piece]` |The piece to mirror.
|
|
705
|
+
|`axis` |`xref:../types/Axis.adoc[Axis]` |The axis ('x' or 'y') to flip across.
|
|
706
|
+
|===
|
|
707
|
+
|
|
708
|
+
**Returns**
|
|
709
|
+
|
|
710
|
+
`xref:../types/Piece.adoc[Piece]` - The mirrored piece.
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
'''
|
|
714
|
+
|
|
715
|
+
=== Grid Analysis
|
|
716
|
+
|
|
717
|
+
Methods for inspecting grid state, finding patterns, and performing searches over the active cell data.
|
|
718
|
+
|
|
719
|
+
==== `getFullRows(): number[]`
|
|
720
|
+
|
|
721
|
+
Identifies all rows that are completely filled with active cells.
|
|
722
|
+
|
|
723
|
+
**Returns**
|
|
724
|
+
|
|
725
|
+
`number[]` - An array of `y` indices representing the filled rows.
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
'''
|
|
729
|
+
|
|
730
|
+
==== `getFullColumns(): number[]`
|
|
731
|
+
|
|
732
|
+
Identifies all columns that are completely filled with active cells.
|
|
733
|
+
|
|
734
|
+
**Returns**
|
|
735
|
+
|
|
736
|
+
`number[]` - An array of `x` indices representing the filled columns.
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
'''
|
|
740
|
+
|
|
741
|
+
==== `getNeighbors(coord: xref:../types/Coordinate.adoc[Coordinate], includeDiagonal: boolean = false): xref:../types/Cell.adoc[Cell][]`
|
|
742
|
+
|
|
743
|
+
Returns all active cells adjacent to a specific coordinate.
|
|
744
|
+
|
|
745
|
+
**Parameters**
|
|
746
|
+
|
|
747
|
+
[cols="1,1,3"]
|
|
748
|
+
|===
|
|
749
|
+
|Name |Type |Description
|
|
750
|
+
|`coord` |`xref:../types/Coordinate.adoc[Coordinate]` |The central coordinate.
|
|
751
|
+
|`includeDiagonal` |`boolean` |If true, checks 8 neighbors; otherwise, checks the 4 cardinal neighbors.
|
|
752
|
+
|===
|
|
753
|
+
|
|
754
|
+
**Returns**
|
|
755
|
+
|
|
756
|
+
`xref:../types/Cell.adoc[Cell][]` - List of neighboring cells found.
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
'''
|
|
760
|
+
|
|
761
|
+
==== `findConnectedCells(coord: xref:../types/Coordinate.adoc[Coordinate]): xref:../types/Piece.adoc[Piece]`
|
|
762
|
+
|
|
763
|
+
Finds all connected active cells of the same value starting from a specific coordinate using a Breadth-First Search (BFS) algorithm.
|
|
764
|
+
|
|
765
|
+
**Parameters**
|
|
766
|
+
|
|
767
|
+
[cols="1,1,3"]
|
|
768
|
+
|===
|
|
769
|
+
|Name |Type |Description
|
|
770
|
+
|`coord` |`xref:../types/Coordinate.adoc[Coordinate]` |The starting point for the search.
|
|
771
|
+
|===
|
|
772
|
+
|
|
773
|
+
**Returns**
|
|
774
|
+
|
|
775
|
+
`xref:../types/Piece.adoc[Piece]` - A collection of all connected cells found.
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
'''
|
|
779
|
+
|
|
780
|
+
==== `swapCells(a: xref:../types/Coordinate.adoc[Coordinate], b: xref:../types/Coordinate.adoc[Coordinate]): void`
|
|
781
|
+
|
|
782
|
+
Swaps the values and colors of two specified cells on the grid.
|
|
783
|
+
|
|
784
|
+
**Parameters**
|
|
785
|
+
|
|
786
|
+
[cols="1,1,3"]
|
|
787
|
+
|===
|
|
788
|
+
|Name |Type |Description
|
|
789
|
+
|`a` |`xref:../types/Coordinate.adoc[Coordinate]` |First coordinate.
|
|
790
|
+
|`b` |`xref:../types/Coordinate.adoc[Coordinate]` |Second coordinate.
|
|
791
|
+
|===
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
'''
|