From 826f5a7fb7085329eb3456757e4490d7eb6db693 Mon Sep 17 00:00:00 2001 From: Vitalii Yehorov Date: Sun, 14 May 2023 16:01:48 +0200 Subject: [PATCH] feat: added todo --- components/cell/cell.tsx | 2 +- components/field/field.tsx | 2 +- components/row/row.tsx | 4 ++-- readme.md | 22 +++++++++++++++++++ store/app-root/app-root.slice.ts | 6 ++--- utils/{ => cell}/create-cell.util.ts | 2 +- utils/{ => cell}/is-cell-highlighted.util.ts | 2 +- .../is-group-end.util.ts} | 0 utils/{ => cell}/is-same-cell.util.ts | 2 +- utils/{ => field}/create-field.util.ts | 4 ++-- utils/{ => field}/create-game-field.util.ts | 4 ++-- utils/{ => field}/fill-field.util.ts | 6 ++--- utils/{ => field}/has-blank-cells.util.ts | 4 ++-- utils/{ => field}/has-value-in-column.util.ts | 2 +- utils/{ => field}/has-value-in-group.util.ts | 2 +- utils/{ => field}/has-value-in-row.util.ts | 2 +- utils/{ => field}/is-correct-cell.util.ts | 2 +- 17 files changed, 45 insertions(+), 23 deletions(-) create mode 100644 readme.md rename utils/{ => cell}/create-cell.util.ts (77%) rename utils/{ => cell}/is-cell-highlighted.util.ts (79%) rename utils/{is-group-last.util.ts => cell/is-group-end.util.ts} (100%) rename utils/{ => cell}/is-same-cell.util.ts (76%) rename utils/{ => field}/create-field.util.ts (86%) rename utils/{ => field}/create-game-field.util.ts (80%) rename utils/{ => field}/fill-field.util.ts (77%) rename utils/{ => field}/has-blank-cells.util.ts (73%) rename utils/{ => field}/has-value-in-column.util.ts (79%) rename utils/{ => field}/has-value-in-group.util.ts (86%) rename utils/{ => field}/has-value-in-row.util.ts (79%) rename utils/{ => field}/is-correct-cell.util.ts (84%) diff --git a/components/cell/cell.tsx b/components/cell/cell.tsx index 9dcc231..670ea24 100644 --- a/components/cell/cell.tsx +++ b/components/cell/cell.tsx @@ -6,7 +6,7 @@ import { BlankCellValue } from '../../interfaces/blank-cell-value'; import { type CellInterface } from '../../interfaces/cell.interface'; import { appRootSelectCellAction } from '../../store/app-root/app-root.actions'; import { appRootSelectedCellSelector } from '../../store/app-root/app-root.selectors'; -import { isSameCell } from '../../utils/is-same-cell.util'; +import { isSameCell } from '../../utils/cell/is-same-cell.util'; import { CellStyles as styles } from './cell.styles'; diff --git a/components/field/field.tsx b/components/field/field.tsx index d0812dd..bc9a6e0 100644 --- a/components/field/field.tsx +++ b/components/field/field.tsx @@ -4,7 +4,7 @@ import { View } from 'react-native'; import { useAppDispatch, useAppSelector } from '../../hooks/redux.hook'; import { appRootLoadAction } from '../../store/app-root/app-root.actions'; import { appRootFieldSelector } from '../../store/app-root/app-root.selectors'; -import { isGroupEnd } from '../../utils/is-group-last.util'; +import { isGroupEnd } from '../../utils/cell/is-group-end.util'; import { Row } from '../row/row'; import { FieldStyles as styles } from './field.styles'; diff --git a/components/row/row.tsx b/components/row/row.tsx index aa29c8f..8997e5a 100644 --- a/components/row/row.tsx +++ b/components/row/row.tsx @@ -4,8 +4,8 @@ import { View } from 'react-native'; import { useAppSelector } from '../../hooks/redux.hook'; import { type CellInterface } from '../../interfaces/cell.interface'; import { appRootSelectedCellSelector } from '../../store/app-root/app-root.selectors'; -import { isCellHighlighted } from '../../utils/is-cell-highlighted.util'; -import { isGroupEnd } from '../../utils/is-group-last.util'; +import { isCellHighlighted } from '../../utils/cell/is-cell-highlighted.util'; +import { isGroupEnd } from '../../utils/cell/is-group-end.util'; import { Cell } from '../cell/cell'; import { RowStyles as styles } from './row.styles'; diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..512e339 --- /dev/null +++ b/readme.md @@ -0,0 +1,22 @@ +# Suuudokuuu + +## TODO +### Frontend +- add RXJS game logic: + - timer + - mistakes + - score +- add animations +- add start screen: + - add difficulty levels +- add exit button to the game +- add game over screen +- add chicken dinner screen +- add theming, dark mode + +### Backend +- setup backend +- add user creation and logic +- add apple gamecenter +- store user solved puzzle by hash, add time +- create leaderboards diff --git a/store/app-root/app-root.slice.ts b/store/app-root/app-root.slice.ts index 546f99b..6610480 100644 --- a/store/app-root/app-root.slice.ts +++ b/store/app-root/app-root.slice.ts @@ -2,9 +2,9 @@ import { createSlice, type PayloadAction } from '@reduxjs/toolkit'; import { isDefined } from '@rnw-community/shared'; import { type CellInterface } from '../../interfaces/cell.interface'; -import { createField } from '../../utils/create-field.util'; -import { createGameField } from '../../utils/create-game-field.util'; -import { isCorrectCell } from '../../utils/is-correct-cell.util'; +import { createField } from '../../utils/field/create-field.util'; +import { createGameField } from '../../utils/field/create-game-field.util'; +import { isCorrectCell } from '../../utils/field/is-correct-cell.util'; import { appRootInitialState } from './app-root.state'; diff --git a/utils/create-cell.util.ts b/utils/cell/create-cell.util.ts similarity index 77% rename from utils/create-cell.util.ts rename to utils/cell/create-cell.util.ts index 085bce1..c8e1e3b 100644 --- a/utils/create-cell.util.ts +++ b/utils/cell/create-cell.util.ts @@ -1,4 +1,4 @@ -import { BlankCellValue } from '../interfaces/blank-cell-value'; +import { BlankCellValue } from '../../interfaces/blank-cell-value'; const getGroupValue = (x: number, y: number): number => Math.floor(x / 3) * 3 + Math.floor(y / 3) + 1; diff --git a/utils/is-cell-highlighted.util.ts b/utils/cell/is-cell-highlighted.util.ts similarity index 79% rename from utils/is-cell-highlighted.util.ts rename to utils/cell/is-cell-highlighted.util.ts index 3bbde32..4999759 100644 --- a/utils/is-cell-highlighted.util.ts +++ b/utils/cell/is-cell-highlighted.util.ts @@ -1,6 +1,6 @@ import { isDefined } from '@rnw-community/shared'; -import { type CellInterface } from '../interfaces/cell.interface'; +import { type CellInterface } from '../../interfaces/cell.interface'; export const isCellHighlighted = (cell: CellInterface, activeCell?: CellInterface): boolean => { return isDefined(activeCell) && (activeCell.x === cell.x || activeCell.y === cell.y || activeCell.group === cell.group); diff --git a/utils/is-group-last.util.ts b/utils/cell/is-group-end.util.ts similarity index 100% rename from utils/is-group-last.util.ts rename to utils/cell/is-group-end.util.ts diff --git a/utils/is-same-cell.util.ts b/utils/cell/is-same-cell.util.ts similarity index 76% rename from utils/is-same-cell.util.ts rename to utils/cell/is-same-cell.util.ts index 5207eec..2bb5ab4 100644 --- a/utils/is-same-cell.util.ts +++ b/utils/cell/is-same-cell.util.ts @@ -1,6 +1,6 @@ import { isDefined } from '@rnw-community/shared'; -import { type CellInterface } from '../interfaces/cell.interface'; +import { type CellInterface } from '../../interfaces/cell.interface'; export const isSameCell = (cell: CellInterface, comparedCell?: CellInterface): boolean => isDefined(comparedCell) && cell.x === comparedCell.x && cell.y === comparedCell.y; diff --git a/utils/create-field.util.ts b/utils/field/create-field.util.ts similarity index 86% rename from utils/create-field.util.ts rename to utils/field/create-field.util.ts index aa8c4a1..a68159b 100644 --- a/utils/create-field.util.ts +++ b/utils/field/create-field.util.ts @@ -1,6 +1,6 @@ -import { type CellInterface } from '../interfaces/cell.interface'; +import { type CellInterface } from '../../interfaces/cell.interface'; +import { createCell } from '../cell/create-cell.util'; -import { createCell } from './create-cell.util'; import { fillField } from './fill-field.util'; const createFillingValues = (length: number): number[] => { diff --git a/utils/create-game-field.util.ts b/utils/field/create-game-field.util.ts similarity index 80% rename from utils/create-game-field.util.ts rename to utils/field/create-game-field.util.ts index 12a0ffa..e17f052 100644 --- a/utils/create-game-field.util.ts +++ b/utils/field/create-game-field.util.ts @@ -1,5 +1,5 @@ -import { BlankCellValue } from '../interfaces/blank-cell-value'; -import { type CellInterface } from '../interfaces/cell.interface'; +import { BlankCellValue } from '../../interfaces/blank-cell-value'; +import { type CellInterface } from '../../interfaces/cell.interface'; const cloneField = (field: CellInterface[][]): CellInterface[][] => field.map(row => row.map(cell => ({ ...cell }))); const getRandomPosition = (field: CellInterface[][]): number => Math.floor(Math.random() * field.length); diff --git a/utils/fill-field.util.ts b/utils/field/fill-field.util.ts similarity index 77% rename from utils/fill-field.util.ts rename to utils/field/fill-field.util.ts index c2e5e61..c846073 100644 --- a/utils/fill-field.util.ts +++ b/utils/field/fill-field.util.ts @@ -1,7 +1,7 @@ -import { BlankCellValue } from '../interfaces/blank-cell-value'; -import { type CellInterface } from '../interfaces/cell.interface'; +import { BlankCellValue } from '../../interfaces/blank-cell-value'; +import { type CellInterface } from '../../interfaces/cell.interface'; +import { createCell } from '../cell/create-cell.util'; -import { createCell } from './create-cell.util'; import { hasBlankCells } from './has-blank-cells.util'; import { isCorrectCell } from './is-correct-cell.util'; diff --git a/utils/has-blank-cells.util.ts b/utils/field/has-blank-cells.util.ts similarity index 73% rename from utils/has-blank-cells.util.ts rename to utils/field/has-blank-cells.util.ts index 7b2b634..26538de 100644 --- a/utils/has-blank-cells.util.ts +++ b/utils/field/has-blank-cells.util.ts @@ -1,5 +1,5 @@ -import { BlankCellValue } from '../interfaces/blank-cell-value'; -import { type CellInterface } from '../interfaces/cell.interface'; +import { BlankCellValue } from '../../interfaces/blank-cell-value'; +import { type CellInterface } from '../../interfaces/cell.interface'; export const hasBlankCells = (field: CellInterface[][]): [boolean, number, number] => { let row = 0; diff --git a/utils/has-value-in-column.util.ts b/utils/field/has-value-in-column.util.ts similarity index 79% rename from utils/has-value-in-column.util.ts rename to utils/field/has-value-in-column.util.ts index e2933e8..364bd37 100644 --- a/utils/has-value-in-column.util.ts +++ b/utils/field/has-value-in-column.util.ts @@ -1,4 +1,4 @@ -import { type CellInterface } from '../interfaces/cell.interface'; +import { type CellInterface } from '../../interfaces/cell.interface'; export const hasValueInColumn = (cell: CellInterface, matrix: CellInterface[][]): boolean => { for (let row = 0; row < matrix.length; row++) { diff --git a/utils/has-value-in-group.util.ts b/utils/field/has-value-in-group.util.ts similarity index 86% rename from utils/has-value-in-group.util.ts rename to utils/field/has-value-in-group.util.ts index f1f8d8b..54a77c2 100644 --- a/utils/has-value-in-group.util.ts +++ b/utils/field/has-value-in-group.util.ts @@ -1,4 +1,4 @@ -import { type CellInterface } from '../interfaces/cell.interface'; +import { type CellInterface } from '../../interfaces/cell.interface'; export const hasValueInGroup = (cell: CellInterface, matrix: CellInterface[][]): boolean => { const boxStartRow = cell.x - (cell.x % 3); diff --git a/utils/has-value-in-row.util.ts b/utils/field/has-value-in-row.util.ts similarity index 79% rename from utils/has-value-in-row.util.ts rename to utils/field/has-value-in-row.util.ts index 726be79..6ceaba2 100644 --- a/utils/has-value-in-row.util.ts +++ b/utils/field/has-value-in-row.util.ts @@ -1,4 +1,4 @@ -import { type CellInterface } from '../interfaces/cell.interface'; +import { type CellInterface } from '../../interfaces/cell.interface'; export const hasValueInRow = (cell: CellInterface, matrix: CellInterface[][]): boolean => { for (let col = 0; col < matrix.length; col++) { diff --git a/utils/is-correct-cell.util.ts b/utils/field/is-correct-cell.util.ts similarity index 84% rename from utils/is-correct-cell.util.ts rename to utils/field/is-correct-cell.util.ts index b086cba..bdf5e1f 100644 --- a/utils/is-correct-cell.util.ts +++ b/utils/field/is-correct-cell.util.ts @@ -1,4 +1,4 @@ -import { type CellInterface } from '../interfaces/cell.interface'; +import { type CellInterface } from '../../interfaces/cell.interface'; import { hasValueInColumn } from './has-value-in-column.util'; import { hasValueInGroup } from './has-value-in-group.util';