From f9fd98d9f50091980f5e4feafffe7cd5c0639d4f Mon Sep 17 00:00:00 2001 From: Ilyas Toumlilt <ilyas@toumlilt.com> Date: Tue, 13 Sep 2022 21:54:57 +0200 Subject: [PATCH] Update License --- single-player/package.json | 2 +- single-player/src/components/Cell.test.tsx | 2 +- single-player/src/components/Cell.tsx | 2 +- single-player/src/components/Game.tsx | 6 +- single-player/src/components/Grid.test.tsx | 168 +++++++++++++-------- single-player/src/components/Grid.tsx | 8 +- single-player/src/components/Header.tsx | 2 +- single-player/src/index.css | 2 +- single-player/src/index.tsx | 2 +- 9 files changed, 117 insertions(+), 77 deletions(-) diff --git a/single-player/package.json b/single-player/package.json index c1be816..12cc82b 100644 --- a/single-player/package.json +++ b/single-player/package.json @@ -2,7 +2,7 @@ "name": "c-sudoku", "description": "Sudoku Demo with CRDT", "version": "1.0.1", - "author": "Yannick Li <yannick.li@concordant.io>", + "author": "Concordant.io <support@concordant.io>", "license": "MIT", "homepage": "./", "dependencies": { diff --git a/single-player/src/components/Cell.test.tsx b/single-player/src/components/Cell.test.tsx index b68bc2e..5abe86d 100644 --- a/single-player/src/components/Cell.test.tsx +++ b/single-player/src/components/Cell.test.tsx @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2020, Concordant and contributors + * Copyright (c) 2022, Concordant and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/single-player/src/components/Cell.tsx b/single-player/src/components/Cell.tsx index 567a9cc..ff1f03f 100644 --- a/single-player/src/components/Cell.tsx +++ b/single-player/src/components/Cell.tsx @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2020, Concordant and contributors + * Copyright (c) 2022, Concordant and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/single-player/src/components/Game.tsx b/single-player/src/components/Game.tsx index fe5328f..3ad093e 100644 --- a/single-player/src/components/Game.tsx +++ b/single-player/src/components/Game.tsx @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2020, Concordant and contributors + * Copyright (c) 2022, Concordant and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -43,9 +43,9 @@ class Game extends React.Component<Record<string, unknown>, IGameState> { super(props); const cells = new Array(81) .fill(null) - .map(() => ({ value: "", modifiable: false})); + .map(() => ({ value: "", modifiable: false })); this.state = { - cells: cells + cells: cells, }; } diff --git a/single-player/src/components/Grid.test.tsx b/single-player/src/components/Grid.test.tsx index acb583a..e63ddce 100644 --- a/single-player/src/components/Grid.test.tsx +++ b/single-player/src/components/Grid.test.tsx @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2020, Concordant and contributors + * Copyright (c) 2022, Concordant and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -159,7 +159,7 @@ describe("checkLine", () => { <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} /> @@ -195,7 +195,7 @@ describe("checkColumn", () => { <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} /> @@ -231,7 +231,7 @@ describe("checkBlock", () => { <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} /> @@ -265,13 +265,15 @@ describe("checkLines", () => { "","","","","","","","","", "","","","","","","","","", "","","","","","","","",""] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkLines()).toStrictEqual([]); @@ -292,13 +294,15 @@ describe("checkLines", () => { "1","8","7","5","2","9","6","4","3", "2","3","4","6","1","8","7","9","5", "9","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkLines()).toStrictEqual([]); @@ -318,13 +322,15 @@ describe("checkLines", () => { "1","8","7","5","2","9","","","3", "2","3","4","6","1","8","7","9","5", "","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkLines()).toStrictEqual([]); @@ -344,13 +350,15 @@ describe("checkLines", () => { "1","8","7","5","2","9","6","4","3", "2","3","4","6","1","8","7","9","5", "9","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkLines()).toStrictEqual([0, 1, 2, 3, 4, 5, 6, 7, 8]); @@ -370,13 +378,15 @@ describe("checkLines", () => { "1","8","7","5","2","9","","","3", "2","3","4","6","1","8","7","9","5", "","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkLines()).toStrictEqual([]); @@ -401,13 +411,15 @@ describe("checkColumns", () => { "","","","","","","","","", "","","","","","","","","", "","","","","","","","",""] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkColumns()).toStrictEqual([]); @@ -428,13 +440,15 @@ describe("checkColumns", () => { "1","8","7","5","2","9","6","4","3", "2","3","4","6","1","8","7","9","5", "9","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkColumns()).toStrictEqual([]); @@ -454,13 +468,15 @@ describe("checkColumns", () => { "1","8","7","5","2","9","","","3", "2","3","4","6","1","8","7","9","5", "","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkColumns()).toStrictEqual([]); @@ -480,13 +496,15 @@ describe("checkColumns", () => { "1","8","7","5","2","9","6","4","3", "2","3","4","6","1","8","7","9","5", "9","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkColumns()).toStrictEqual([ @@ -516,13 +534,15 @@ describe("checkColumns", () => { "1","8","7","5","2","9","","","3", "2","3","4","6","1","8","7","9","5", "","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkColumns()).toStrictEqual([]); @@ -547,13 +567,15 @@ describe("checkBlocks", () => { "","","","","","","","","", "","","","","","","","","", "","","","","","","","",""] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkBlocks()).toStrictEqual([]); @@ -574,13 +596,15 @@ describe("checkBlocks", () => { "1","8","7","5","2","9","6","4","3", "2","3","4","6","1","8","7","9","5", "9","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkBlocks()).toStrictEqual([]); @@ -600,13 +624,15 @@ describe("checkBlocks", () => { "1","8","7","5","2","9","","","3", "2","3","4","6","1","8","7","9","5", "","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkBlocks()).toStrictEqual([]); @@ -626,13 +652,15 @@ describe("checkBlocks", () => { "1","8","7","5","2","9","6","4","3", "2","3","4","6","1","8","7","9","5", "9","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkBlocks()).toStrictEqual([0, 1, 2, 9, 10, 11, 18, 19, 20]); @@ -652,13 +680,15 @@ describe("checkBlocks", () => { "1","8","7","5","2","9","","","3", "2","3","4","6","1","8","7","9","5", "","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkBlocks()).toStrictEqual([]); @@ -683,13 +713,15 @@ describe("checkCells", () => { "","","","","","","","","", "","","","","","","","","", "","","","","","","","",""] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkCells()).toStrictEqual([]); @@ -710,13 +742,15 @@ describe("checkCells", () => { "1","8","7","5","2","9","6","4","3", "2","3","4","6","1","8","7","9","5", "9","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkCells()).toStrictEqual([]); @@ -736,13 +770,15 @@ describe("checkCells", () => { "1","8","7","5","2","9","","","3", "2","3","4","6","1","8","7","9","5", "","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkCells()).toStrictEqual([]); @@ -762,13 +798,15 @@ describe("checkCells", () => { "1","8","7","5","2","9","6","4","3", "2","3","4","6","1","8","7","9","5", "9","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkCells()).toStrictEqual([]); @@ -788,13 +826,15 @@ describe("checkCells", () => { "1","8","7","5","2","9","","","3", "2","3","4","6","1","8","7","9","5", "","6","5","7","4","3","1","8","2"] - const wrapper = shallow(<Grid + const wrapper = shallow( + <Grid cells={initVal.map((val) => ({ value: val, - modifiable: false + modifiable: false, }))} onChange={() => ({})} - />); + /> + ); const game = wrapper.instance(); expect(game.checkCells()).toStrictEqual([0, 1]); diff --git a/single-player/src/components/Grid.tsx b/single-player/src/components/Grid.tsx index 2e8799f..5cd8312 100644 --- a/single-player/src/components/Grid.tsx +++ b/single-player/src/components/Grid.tsx @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2020, Concordant and contributors + * Copyright (c) 2022, Concordant and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -39,7 +39,7 @@ interface IGridProps { * This class represent the grid of the Sudoku */ class Grid extends React.Component<IGridProps> { - errors : boolean[] = new Array(81).fill(false); + errors: boolean[] = new Array(81).fill(false); handleChange(index: number, value: string): void { this.props.onChange(index, value); @@ -120,7 +120,7 @@ class Grid extends React.Component<IGridProps> { * Check if a line respect Sudoku lines rules. * @param line The line number to be checked. */ - checkLine(line: number): boolean { + checkLine(line: number): boolean { assert.ok(line >= 0 && line < 9); const cpt = Array(9).fill(0); for (let column = 0; column < 9; column++) { @@ -231,7 +231,7 @@ class Grid extends React.Component<IGridProps> { * Check if all cells respect Sudoku rules and update cells. * @param cells Current cells values. */ - checkAll(): boolean { + checkAll(): boolean { let errorIndexList = this.checkLines(); errorIndexList = errorIndexList.concat(this.checkColumns()); errorIndexList = errorIndexList.concat(this.checkBlocks()); diff --git a/single-player/src/components/Header.tsx b/single-player/src/components/Header.tsx index fab0cb2..88221b8 100644 --- a/single-player/src/components/Header.tsx +++ b/single-player/src/components/Header.tsx @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2020, Concordant and contributors + * Copyright (c) 2022, Concordant and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/single-player/src/index.css b/single-player/src/index.css index fd4309a..a0abc98 100644 --- a/single-player/src/index.css +++ b/single-player/src/index.css @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2020, Concordant and contributors + * Copyright (c) 2022, Concordant and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/single-player/src/index.tsx b/single-player/src/index.tsx index 0bcde47..0716529 100644 --- a/single-player/src/index.tsx +++ b/single-player/src/index.tsx @@ -1,7 +1,7 @@ /** * MIT License * - * Copyright (c) 2020, Concordant and contributors + * Copyright (c) 2022, Concordant and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal -- GitLab