| Conditions | 2 |
| Total Lines | 12 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | export const state = { |
||
| 28 | |||
| 29 | export function setStateFromIndex(wordIndex: number): void { |
||
| 30 | // Convert word index (0-2047) to binary and set the boxes |
||
| 31 | // Note: wordIndex + 1 gives us the actual number (1-2048) |
||
| 32 | const value = wordIndex + 1; |
||
| 33 | |||
| 34 | resetBoxes(); |
||
| 35 | |||
| 36 | for (let i = 0; i < 12; i++) { |
||
| 37 | const bitPosition = 11 - i; |
||
| 38 | const bitValue = Math.pow(2, bitPosition); |
||
| 39 | state.boxes[i] = (value & bitValue) !== 0; |
||
| 40 | } |
||
| 42 |