Skip to content

Commit

Permalink
feat: added todo
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalyiegorov committed May 14, 2023
1 parent 3d413dd commit 826f5a7
Show file tree
Hide file tree
Showing 17 changed files with 45 additions and 23 deletions.
2 changes: 1 addition & 1 deletion components/cell/cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion components/field/field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions components/row/row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
22 changes: 22 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions store/app-root/app-root.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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[] => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
6 changes: 3 additions & 3 deletions utils/fill-field.util.ts → utils/field/fill-field.util.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down

0 comments on commit 826f5a7

Please sign in to comment.