brick-engine-js 1.0.8 → 1.0.10

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.
Files changed (280) hide show
  1. package/dist/app.js +1 -4952
  2. package/dist/brick-engine.js +1 -4970
  3. package/dist/css/{app.bundle.css → app.0ce9b8479d1758fc15ba.css} +0 -2
  4. package/dist/css/{brick-engine.bundle.css → brick-engine.0ce9b8479d1758fc15ba.css} +0 -2
  5. package/dist/docs/GAME_DEVELOPER_GUIDE.html +1 -1
  6. package/dist/docs/brick-engine-guide.html +1 -1
  7. package/dist/docs/getting-started.html +1 -1
  8. package/dist/docs/jsdoc_standard.html +1 -1
  9. package/dist/docs/publishing.html +1 -1
  10. package/dist/docs/reference/interfaces/modules/Session.html +1 -1
  11. package/dist/docs/reference/modules/GameMenu.html +1 -1
  12. package/dist/docs/reference/modules/GameSession.html +1 -1
  13. package/dist/docs/reference/modules/InitialStateSnapshot.html +1 -1
  14. package/dist/docs/reference/modules/SessionModal.html +1 -1
  15. package/dist/docs/testing_best_practices.html +1 -1
  16. package/dist/index.html +1 -15
  17. package/dist/vendor/p5.min.js +1 -1
  18. package/package.json +2 -4
  19. package/dist/app.js.map +0 -1
  20. package/dist/brick-engine.js.map +0 -1
  21. package/dist/css/app.bundle.css.map +0 -1
  22. package/dist/css/brick-engine.bundle.css.map +0 -1
  23. package/docs/GAME_DEVELOPER_GUIDE.adoc +0 -167
  24. package/docs/brick-engine-guide.adoc +0 -87
  25. package/docs/diagrams/lifecycle.mmd +0 -19
  26. package/docs/documentation_style_guide.adoc +0 -210
  27. package/docs/getting-started.adoc +0 -147
  28. package/docs/images/lifecycle.svg +0 -1
  29. package/docs/jsdoc_standard.adoc +0 -109
  30. package/docs/publishing.adoc +0 -58
  31. package/docs/reference/enums/Color.adoc +0 -35
  32. package/docs/reference/enums/ControlEventType.adoc +0 -28
  33. package/docs/reference/enums/ControlKey.adoc +0 -34
  34. package/docs/reference/enums/FontAlignment.adoc +0 -43
  35. package/docs/reference/enums/FontSize.adoc +0 -31
  36. package/docs/reference/enums/Sound.adoc +0 -42
  37. package/docs/reference/enums/StateProperty.adoc +0 -33
  38. package/docs/reference/helpers/CellHelper.adoc +0 -37
  39. package/docs/reference/helpers/ControlInputHandlerHelper.adoc +0 -57
  40. package/docs/reference/helpers/CoordinateHelper.adoc +0 -118
  41. package/docs/reference/helpers/RelativeValuesHelper.adoc +0 -53
  42. package/docs/reference/interfaces/Debuggable.adoc +0 -29
  43. package/docs/reference/interfaces/GameModules.adoc +0 -35
  44. package/docs/reference/interfaces/Initializable.adoc +0 -24
  45. package/docs/reference/interfaces/RendererInitializable.adoc +0 -33
  46. package/docs/reference/interfaces/StateSyncable.adoc +0 -41
  47. package/docs/reference/interfaces/modules/Control.adoc +0 -98
  48. package/docs/reference/interfaces/modules/Grid.adoc +0 -411
  49. package/docs/reference/interfaces/modules/Renderer.adoc +0 -34
  50. package/docs/reference/interfaces/modules/RendererComposite.adoc +0 -57
  51. package/docs/reference/interfaces/modules/Score.adoc +0 -107
  52. package/docs/reference/interfaces/modules/Session.adoc +0 -66
  53. package/docs/reference/interfaces/modules/State.adoc +0 -290
  54. package/docs/reference/interfaces/modules/Text.adoc +0 -110
  55. package/docs/reference/interfaces/modules/Time.adoc +0 -119
  56. package/docs/reference/modules/Debugger.adoc +0 -71
  57. package/docs/reference/modules/DisplayRenderer.adoc +0 -55
  58. package/docs/reference/modules/Game.adoc +0 -256
  59. package/docs/reference/modules/GameControl.adoc +0 -139
  60. package/docs/reference/modules/GameGrid.adoc +0 -794
  61. package/docs/reference/modules/GameHudGrid.adoc +0 -38
  62. package/docs/reference/modules/GameMenu.adoc +0 -39
  63. package/docs/reference/modules/GameRenderer.adoc +0 -79
  64. package/docs/reference/modules/GameScore.adoc +0 -138
  65. package/docs/reference/modules/GameSession.adoc +0 -43
  66. package/docs/reference/modules/GameSound.adoc +0 -111
  67. package/docs/reference/modules/GameState.adoc +0 -318
  68. package/docs/reference/modules/GameText.adoc +0 -139
  69. package/docs/reference/modules/GameTime.adoc +0 -141
  70. package/docs/reference/modules/HudRenderer.adoc +0 -56
  71. package/docs/reference/modules/InitialStateSnapshot.adoc +0 -47
  72. package/docs/reference/modules/SessionModal.adoc +0 -34
  73. package/docs/reference/types/Axis.adoc +0 -28
  74. package/docs/reference/types/Cell.adoc +0 -29
  75. package/docs/reference/types/ControlCallback.adoc +0 -23
  76. package/docs/reference/types/Coordinate.adoc +0 -29
  77. package/docs/reference/types/GameEntry.adoc +0 -29
  78. package/docs/reference/types/GameEvent.adoc +0 -29
  79. package/docs/reference/types/Piece.adoc +0 -32
  80. package/docs/reference/types/RendererMetrics.adoc +0 -29
  81. package/docs/reference/types/Vector.adoc +0 -28
  82. package/docs/testing_best_practices.adoc +0 -190
  83. package/public/CNAME +0 -1
  84. package/public/docs/GAME_DEVELOPER_GUIDE.html +0 -727
  85. package/public/docs/brick-engine-guide.html +0 -610
  86. package/public/docs/diagrams/lifecycle.mmd +0 -19
  87. package/public/docs/documentation_style_guide.html +0 -994
  88. package/public/docs/getting-started.html +0 -648
  89. package/public/docs/images/lifecycle.svg +0 -1
  90. package/public/docs/index.html +0 -593
  91. package/public/docs/jsdoc_standard.html +0 -656
  92. package/public/docs/publishing.html +0 -573
  93. package/public/docs/reference/enums/Color.html +0 -533
  94. package/public/docs/reference/enums/ControlEventType.html +0 -505
  95. package/public/docs/reference/enums/ControlKey.html +0 -529
  96. package/public/docs/reference/enums/FontAlignment.html +0 -545
  97. package/public/docs/reference/enums/FontSize.html +0 -517
  98. package/public/docs/reference/enums/Sound.html +0 -558
  99. package/public/docs/reference/enums/StateProperty.html +0 -525
  100. package/public/docs/reference/helpers/CellHelper.html +0 -520
  101. package/public/docs/reference/helpers/ControlInputHandlerHelper.html +0 -569
  102. package/public/docs/reference/helpers/CoordinateHelper.html +0 -703
  103. package/public/docs/reference/helpers/RelativeValuesHelper.html +0 -560
  104. package/public/docs/reference/interfaces/Debuggable.html +0 -501
  105. package/public/docs/reference/interfaces/GameModules.html +0 -544
  106. package/public/docs/reference/interfaces/Initializable.html +0 -495
  107. package/public/docs/reference/interfaces/RendererInitializable.html +0 -517
  108. package/public/docs/reference/interfaces/StateSyncable.html +0 -542
  109. package/public/docs/reference/interfaces/modules/Control.html +0 -648
  110. package/public/docs/reference/interfaces/modules/Grid.html +0 -1256
  111. package/public/docs/reference/interfaces/modules/Renderer.html +0 -522
  112. package/public/docs/reference/interfaces/modules/RendererComposite.html +0 -577
  113. package/public/docs/reference/interfaces/modules/Score.html +0 -669
  114. package/public/docs/reference/interfaces/modules/Session.html +0 -585
  115. package/public/docs/reference/interfaces/modules/State.html +0 -897
  116. package/public/docs/reference/interfaces/modules/Text.html +0 -668
  117. package/public/docs/reference/interfaces/modules/Time.html +0 -684
  118. package/public/docs/reference/modules/Debugger.html +0 -579
  119. package/public/docs/reference/modules/DisplayRenderer.html +0 -557
  120. package/public/docs/reference/modules/Game.html +0 -909
  121. package/public/docs/reference/modules/GameControl.html +0 -716
  122. package/public/docs/reference/modules/GameGrid.html +0 -1910
  123. package/public/docs/reference/modules/GameHudGrid.html +0 -508
  124. package/public/docs/reference/modules/GameMenu.html +0 -538
  125. package/public/docs/reference/modules/GameRenderer.html +0 -589
  126. package/public/docs/reference/modules/GameScore.html +0 -664
  127. package/public/docs/reference/modules/GameSession.html +0 -533
  128. package/public/docs/reference/modules/GameSound.html +0 -636
  129. package/public/docs/reference/modules/GameState.html +0 -922
  130. package/public/docs/reference/modules/GameText.html +0 -701
  131. package/public/docs/reference/modules/GameTime.html +0 -696
  132. package/public/docs/reference/modules/HudRenderer.html +0 -568
  133. package/public/docs/reference/modules/InitialStateSnapshot.html +0 -557
  134. package/public/docs/reference/modules/SessionModal.html +0 -520
  135. package/public/docs/reference/types/Axis.html +0 -505
  136. package/public/docs/reference/types/Cell.html +0 -514
  137. package/public/docs/reference/types/ControlCallback.html +0 -488
  138. package/public/docs/reference/types/Coordinate.html +0 -510
  139. package/public/docs/reference/types/GameEntry.html +0 -514
  140. package/public/docs/reference/types/GameEvent.html +0 -514
  141. package/public/docs/reference/types/Piece.html +0 -506
  142. package/public/docs/reference/types/RendererMetrics.html +0 -514
  143. package/public/docs/reference/types/Vector.html +0 -509
  144. package/public/docs/testing_best_practices.html +0 -770
  145. package/public/favicon.ico +0 -0
  146. package/public/fonts/digital-7.monoitalic.ttf +0 -0
  147. package/public/images/cell.svg +0 -32
  148. package/public/images/close.png +0 -0
  149. package/public/images/games.png +0 -0
  150. package/public/images/github.png +0 -0
  151. package/public/images/letter-a.png +0 -0
  152. package/public/images/letter-d.png +0 -0
  153. package/public/images/letter-j.png +0 -0
  154. package/public/images/letter-s.png +0 -0
  155. package/public/images/letter-w.png +0 -0
  156. package/public/images/meta-image.png +0 -0
  157. package/public/images/number-1.png +0 -0
  158. package/public/images/number-2.png +0 -0
  159. package/public/images/number-3.png +0 -0
  160. package/public/images/number-4.png +0 -0
  161. package/public/images/number-5.png +0 -0
  162. package/public/images/number-6.png +0 -0
  163. package/public/images/splash.gif +0 -0
  164. package/public/index.html +0 -15
  165. package/public/sounds/sound_00.wav +0 -0
  166. package/public/sounds/sound_01.wav +0 -0
  167. package/public/sounds/sound_02.wav +0 -0
  168. package/public/sounds/sound_03.wav +0 -0
  169. package/public/sounds/sound_04.wav +0 -0
  170. package/public/sounds/sound_05.wav +0 -0
  171. package/public/sounds/sound_06.wav +0 -0
  172. package/public/sounds/sound_07.wav +0 -0
  173. package/public/sounds/sound_08.wav +0 -0
  174. package/public/sounds/sound_09.wav +0 -0
  175. package/public/sounds/sound_10.wav +0 -0
  176. package/public/sounds/sound_11.wav +0 -0
  177. package/public/sounds/sound_12.wav +0 -0
  178. package/public/sounds/sound_13.wav +0 -0
  179. package/public/sounds/sound_14.wav +0 -0
  180. package/public/sounds/sound_15.wav +0 -0
  181. package/public/style/body.css +0 -86
  182. package/public/style/buttons.css +0 -233
  183. package/public/style/debugger.css +0 -117
  184. package/public/style/sessionModal.css +0 -155
  185. package/public/style/sourceCodeAndCommands.css +0 -74
  186. package/public/style/splash.css +0 -13
  187. package/public/style/theme.css +0 -137
  188. /package/dist/{bootstrap.d.ts → types/bootstrap.d.ts} +0 -0
  189. /package/dist/{bootstrap.test.d.ts → types/bootstrap.test.d.ts} +0 -0
  190. /package/dist/{config → types/config}/configs.d.ts +0 -0
  191. /package/dist/{config → types/config}/configs.test.d.ts +0 -0
  192. /package/dist/{core → types/core}/Game.d.ts +0 -0
  193. /package/dist/{core → types/core}/Game.test.d.ts +0 -0
  194. /package/dist/{core → types/core}/InitialStateSnapshot.d.ts +0 -0
  195. /package/dist/{core → types/core}/InitialStateSnapshot.test.d.ts +0 -0
  196. /package/dist/{core → types/core}/helpers/CellHelper.d.ts +0 -0
  197. /package/dist/{core → types/core}/helpers/CellHelper.test.d.ts +0 -0
  198. /package/dist/{core → types/core}/helpers/ControlInputHandlerHelper.d.ts +0 -0
  199. /package/dist/{core → types/core}/helpers/ControlInputHandlerHelper.test.d.ts +0 -0
  200. /package/dist/{core → types/core}/helpers/CoordinateHelper.d.ts +0 -0
  201. /package/dist/{core → types/core}/helpers/CoordinateHelper.test.d.ts +0 -0
  202. /package/dist/{core → types/core}/helpers/InterfaceIdentifierHelper.d.ts +0 -0
  203. /package/dist/{core → types/core}/helpers/InterfaceIdentifierHelper.test.d.ts +0 -0
  204. /package/dist/{core → types/core}/helpers/RelativeValuesHelper.d.ts +0 -0
  205. /package/dist/{core → types/core}/helpers/RelativeValuesHelper.test.d.ts +0 -0
  206. /package/dist/{core → types/core}/module/control/GameControl.d.ts +0 -0
  207. /package/dist/{core → types/core}/module/control/GameControl.test.d.ts +0 -0
  208. /package/dist/{core → types/core}/module/control/GameControlKeyBinding.d.ts +0 -0
  209. /package/dist/{core → types/core}/module/control/GameControlKeyBinding.test.d.ts +0 -0
  210. /package/dist/{core → types/core}/module/grid/GameGrid.d.ts +0 -0
  211. /package/dist/{core → types/core}/module/grid/GameGrid.test.d.ts +0 -0
  212. /package/dist/{core → types/core}/module/grid/GameHudGrid.d.ts +0 -0
  213. /package/dist/{core → types/core}/module/grid/GameHudGrid.test.d.ts +0 -0
  214. /package/dist/{core → types/core}/module/grid/engines/GridAnalysisEngine.d.ts +0 -0
  215. /package/dist/{core → types/core}/module/grid/engines/GridAnalysisEngine.test.d.ts +0 -0
  216. /package/dist/{core → types/core}/module/grid/engines/GridLineEngine.d.ts +0 -0
  217. /package/dist/{core → types/core}/module/grid/engines/GridLineEngine.test.d.ts +0 -0
  218. /package/dist/{core → types/core}/module/grid/engines/GridMovementEngine.d.ts +0 -0
  219. /package/dist/{core → types/core}/module/grid/engines/GridMovementEngine.test.d.ts +0 -0
  220. /package/dist/{core → types/core}/module/grid/engines/GridRegionEngine.d.ts +0 -0
  221. /package/dist/{core → types/core}/module/grid/engines/GridRegionEngine.test.d.ts +0 -0
  222. /package/dist/{core → types/core}/module/grid/engines/GridTransformEngine.d.ts +0 -0
  223. /package/dist/{core → types/core}/module/grid/engines/GridTransformEngine.test.d.ts +0 -0
  224. /package/dist/{core → types/core}/module/renderer/DisplayRenderer.d.ts +0 -0
  225. /package/dist/{core → types/core}/module/renderer/DisplayRenderer.test.d.ts +0 -0
  226. /package/dist/{core → types/core}/module/renderer/GameRenderer.d.ts +0 -0
  227. /package/dist/{core → types/core}/module/renderer/GameRenderer.test.d.ts +0 -0
  228. /package/dist/{core → types/core}/module/renderer/HudRenderer.d.ts +0 -0
  229. /package/dist/{core → types/core}/module/renderer/HudRenderer.test.d.ts +0 -0
  230. /package/dist/{core → types/core}/module/score/GameScore.d.ts +0 -0
  231. /package/dist/{core → types/core}/module/score/GameScore.test.d.ts +0 -0
  232. /package/dist/{core → types/core}/module/session/GameSession.d.ts +0 -0
  233. /package/dist/{core → types/core}/module/session/GameSession.test.d.ts +0 -0
  234. /package/dist/{core → types/core}/module/sound/GameSound.d.ts +0 -0
  235. /package/dist/{core → types/core}/module/sound/GameSound.test.d.ts +0 -0
  236. /package/dist/{core → types/core}/module/state/GameState.d.ts +0 -0
  237. /package/dist/{core → types/core}/module/state/GameState.test.d.ts +0 -0
  238. /package/dist/{core → types/core}/module/text/GameText.d.ts +0 -0
  239. /package/dist/{core → types/core}/module/text/GameText.test.d.ts +0 -0
  240. /package/dist/{core → types/core}/module/time/GameTime.d.ts +0 -0
  241. /package/dist/{core → types/core}/module/time/GameTime.test.d.ts +0 -0
  242. /package/dist/{core → types/core}/types/Interfaces.d.ts +0 -0
  243. /package/dist/{core → types/core}/types/Types.d.ts +0 -0
  244. /package/dist/{core → types/core}/types/enums.d.ts +0 -0
  245. /package/dist/{core → types/core}/types/modules.d.ts +0 -0
  246. /package/dist/{index.d.ts → types/index.d.ts} +0 -0
  247. /package/dist/{main.d.ts → types/main.d.ts} +0 -0
  248. /package/dist/{menu → types/menu}/GameMenu.d.ts +0 -0
  249. /package/dist/{menu → types/menu}/GameMenu.test.d.ts +0 -0
  250. /package/dist/{menu → types/menu}/GameMenuSingleton.d.ts +0 -0
  251. /package/dist/{menu → types/menu}/GameMenuSingleton.test.d.ts +0 -0
  252. /package/dist/{menu → types/menu}/GameRepository.d.ts +0 -0
  253. /package/dist/{menu → types/menu}/GameRepository.test.d.ts +0 -0
  254. /package/dist/{menu → types/menu}/manager/GameManager.d.ts +0 -0
  255. /package/dist/{menu → types/menu}/manager/GameManager.test.d.ts +0 -0
  256. /package/dist/types/{interfaces.d.ts → types/interfaces.d.ts} +0 -0
  257. /package/dist/{view → types/view}/Debugger.d.ts +0 -0
  258. /package/dist/{view → types/view}/Debugger.test.d.ts +0 -0
  259. /package/dist/{view → types/view}/GameView.d.ts +0 -0
  260. /package/dist/{view → types/view}/GameView.test.d.ts +0 -0
  261. /package/dist/{view → types/view}/SessionModal.d.ts +0 -0
  262. /package/dist/{view → types/view}/SessionModal.test.d.ts +0 -0
  263. /package/dist/{view → types/view}/components/layout/ButtonLayout.d.ts +0 -0
  264. /package/dist/{view → types/view}/components/layout/ButtonLayout.test.d.ts +0 -0
  265. /package/dist/{view → types/view}/components/layout/ContainerLayout.d.ts +0 -0
  266. /package/dist/{view → types/view}/components/layout/ContainerLayout.test.d.ts +0 -0
  267. /package/dist/{view → types/view}/components/layout/FrameLayout.d.ts +0 -0
  268. /package/dist/{view → types/view}/components/layout/FrameLayout.test.d.ts +0 -0
  269. /package/dist/{view → types/view}/components/ui/BigButton.d.ts +0 -0
  270. /package/dist/{view → types/view}/components/ui/BigButton.test.d.ts +0 -0
  271. /package/dist/{view → types/view}/components/ui/Button.d.ts +0 -0
  272. /package/dist/{view → types/view}/components/ui/Button.test.d.ts +0 -0
  273. /package/dist/{view → types/view}/components/ui/Canvas.d.ts +0 -0
  274. /package/dist/{view → types/view}/components/ui/Canvas.test.d.ts +0 -0
  275. /package/dist/{view → types/view}/components/ui/SmallButton.d.ts +0 -0
  276. /package/dist/{view → types/view}/components/ui/SmallButton.test.d.ts +0 -0
  277. /package/dist/{view → types/view}/theme/applyColors.d.ts +0 -0
  278. /package/dist/{view → types/view}/theme/applyColors.test.d.ts +0 -0
  279. /package/dist/{view → types/view}/theme/dimensions.d.ts +0 -0
  280. /package/dist/{view → types/view}/theme/dimensions.test.d.ts +0 -0
@@ -1,794 +0,0 @@
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
- '''