|
123456789101112131415161718192021222324 |
- interface Context {
- itemsCount: number
- }
-
- class Position {
- x: number
- y: number
-
- constructor(x, y) {
- this.x = x
- this.y = y
- }
- }
-
- function memoryItemPositions(c: Context): Position[] {
- var pos: Position[] = []
- for (var i = 0; i < c.itemsCount; i++) {
- let row = Math.floor(i / 4)
- let x = memoryGap() + (i - row * 4) * memoryGap()
- let y = memoryGap() + row * memoryGap()
- pos.push(new Position(x, y))
- }
- return pos
- }
|