patch lerna bootstrap command

This commit is contained in:
Sorrel Bri 2020-04-16 23:19:39 -07:00
parent 2c39fe1156
commit dde97e2a1f
8 changed files with 23093 additions and 23896 deletions

18858
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@
"private": true, "private": true,
"scripts": { "scripts": {
"test": "lerna run test", "test": "lerna run test",
"bootstrap": "lerna bootstrap" "bootstrap": "lerna bootstrap --hoist"
}, },
"dependencies": { "dependencies": {
"react": "^16.13.1", "react": "^16.13.1",

File diff suppressed because it is too large Load diff

View file

@ -6,16 +6,18 @@
"@mars/heroku-js-runtime-env": "^3.0.2", "@mars/heroku-js-runtime-env": "^3.0.2",
"@testing-library/user-event": "^7.1.2", "@testing-library/user-event": "^7.1.2",
"node-sass": "^4.13.0", "node-sass": "^4.13.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.1.2", "react-router-dom": "^5.1.2",
"react-scripts": "^3.4.0", "react-scripts": "^3.4.0",
"socket.io-client": "^2.3.0" "socket.io-client": "^2.3.0"
}, },
"peerDependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
"scripts": { "scripts": {
"start": "REACT_APP_ENVIRONMENT='development' react-scripts start", "start": "REACT_APP_ENVIRONMENT='development' react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",
"test": "react-scripts test", "test": "CI=true react-scripts test",
"eject": "react-scripts eject", "eject": "react-scripts eject",
"flow": "./node_modules/.bin/flow", "flow": "./node_modules/.bin/flow",
"predeploy": "REACT_APP_ENVIRONMENT=production npm run build", "predeploy": "REACT_APP_ENVIRONMENT=production npm run build",

View file

@ -38,6 +38,39 @@ const HANDI_REC = {
] ]
} }
// index represents handicap placement for different board-sizes, eg handiPlace['9][1] = { (3, 3), (7, 7) }
// last array in each property also used for hoshi rendering
const HANDI_PLACE = {
'9' : [
0, 0,
[[ 7, 3 ], [ 3, 7 ] ],
[ [ 7, 7 ], [ 7, 3 ], [ 3, 7 ] ],
[ [ 3, 3 ], [ 7, 7 ], [ 3, 7 ], [ 7, 3 ] ]
],
'13' : [
0, 0,
[ [ 4, 10 ], [ 10, 4 ] ],
[ [ 10, 10 ], [ 4, 10 ], [ 10, 4] ],
[ [ 4, 4 ], [ 10, 10 ], [ 4, 10 ], [ 10, 4] ],
[ [ 7, 7 ], [ 4, 4 ], [ 10, 10 ], [ 4, 10 ], [ 10, 4] ],
[ [ 7, 4 ], [ 4, 7 ], [ 4, 4 ], [ 10, 10 ], [ 4, 10 ], [ 10, 4] ],
[ [ 7, 7 ], [ 7, 4 ], [ 4, 7 ], [ 4, 4 ], [ 10, 10 ], [ 4, 10 ], [ 10, 4] ],
[ [ 10, 7 ], [ 7, 4 ], [ 7, 10 ], [ 4, 7 ], [ 4, 4 ], [ 10, 10 ], [ 4, 10 ], [ 10, 4] ],
[ [ 7, 7 ], [ 10, 7 ], [ 7, 4 ], [ 7, 10 ], [ 4, 7 ], [ 4, 4 ], [ 10, 10 ], [ 4, 10 ], [ 10, 4] ],
],
'19' : [
0, 0,
[ [ 4, 16 ], [ 16, 4 ] ],
[ [ 16, 16 ], [ 4, 16 ], [ 16, 4] ],
[ [ 4, 4 ], [ 16, 16 ], [ 4, 16 ], [ 16, 4] ],
[ [ 10, 10 ], [ 4, 4 ], [ 16, 16 ], [ 4, 16 ], [ 16, 4] ],
[ [ 10, 4 ], [ 4, 10 ], [ 4, 4 ], [ 16, 16 ], [ 4, 16 ], [ 16, 4] ],
[ [ 10, 10 ], [ 10, 4 ], [ 4, 10 ], [ 4, 4 ], [ 16, 16 ], [ 4, 16 ], [ 16, 4] ],
[ [ 16, 10 ], [ 10, 4 ], [ 10, 16 ], [ 4, 10 ], [ 4, 4 ], [ 16, 16 ], [ 4, 16 ], [ 16, 4] ],
[ [ 10, 10 ], [ 16, 10 ], [ 10, 4 ], [ 10, 16 ], [ 4, 10 ], [ 4, 4 ], [ 16, 16 ], [ 4, 16 ], [ 16, 4] ],
]
};
class Game { class Game {
constructor(gameData, gameRecord) { constructor(gameData, gameRecord) {
this.winner = gameData.winner || null, this.winner = gameData.winner || null,
@ -46,22 +79,22 @@ class Game {
this.komi = gameData.komi || 6.5, // komi depends on handicap stones + player rank this.komi = gameData.komi || 6.5, // komi depends on handicap stones + player rank
this.handicap = gameData.handicap || 0, this.handicap = gameData.handicap || 0,
this.boardSize = gameData.boardSize || 19, this.boardSize = gameData.boardSize || 19,
this.groups = {},
this.boardState = [],
this.gameRecord = gameRecord || [],
this.playerState = gameData.playerState || { this.playerState = gameData.playerState || {
bCaptures: 0, bCaptures: 0,
wCaptures: 0, wCaptures: 0,
bScore: 0, bScore: 0,
wScore: 0 wScore: 0
}, }
this.gameRecord = gameRecord || [],
this.groups = {},
this.boardState = []
} }
initGame = () => { initGame = () => {
this.winner = null; this.winner = null;
this.pass = null; this.pass = null;
this.turn = this.handicap ? -1 : 1; this.turn = this.handicap ? -1 : 1;
this.initBoard(); this.initBoard();
return this.getBoardState(); return this.getBoardState();
} }
@ -139,38 +172,6 @@ class Game {
} }
// index represents handicap placement for different board-sizes, eg handiPlace['9][1] = { (3, 3), (7, 7) }
// last array in each property also used for hoshi rendering
const HANDI_PLACE = {
'9' : [
0, 0,
[[ 7, 3 ], [ 3, 7 ] ],
[ [ 7, 7 ], [ 7, 3 ], [ 3, 7 ] ],
[ [ 3, 3 ], [ 7, 7 ], [ 3, 7 ], [ 7, 3 ] ]
],
'13' : [
0, 0,
[ [ 4, 10 ], [ 10, 4 ] ],
[ [ 10, 10 ], [ 4, 10 ], [ 10, 4] ],
[ [ 4, 4 ], [ 10, 10 ], [ 4, 10 ], [ 10, 4] ],
[ [ 7, 7 ], [ 4, 4 ], [ 10, 10 ], [ 4, 10 ], [ 10, 4] ],
[ [ 7, 4 ], [ 4, 7 ], [ 4, 4 ], [ 10, 10 ], [ 4, 10 ], [ 10, 4] ],
[ [ 7, 7 ], [ 7, 4 ], [ 4, 7 ], [ 4, 4 ], [ 10, 10 ], [ 4, 10 ], [ 10, 4] ],
[ [ 10, 7 ], [ 7, 4 ], [ 7, 10 ], [ 4, 7 ], [ 4, 4 ], [ 10, 10 ], [ 4, 10 ], [ 10, 4] ],
[ [ 7, 7 ], [ 10, 7 ], [ 7, 4 ], [ 7, 10 ], [ 4, 7 ], [ 4, 4 ], [ 10, 10 ], [ 4, 10 ], [ 10, 4] ],
],
'19' : [
0, 0,
[ [ 4, 16 ], [ 16, 4 ] ],
[ [ 16, 16 ], [ 4, 16 ], [ 16, 4] ],
[ [ 4, 4 ], [ 16, 16 ], [ 4, 16 ], [ 16, 4] ],
[ [ 10, 10 ], [ 4, 4 ], [ 16, 16 ], [ 4, 16 ], [ 16, 4] ],
[ [ 10, 4 ], [ 4, 10 ], [ 4, 4 ], [ 16, 16 ], [ 4, 16 ], [ 16, 4] ],
[ [ 10, 10 ], [ 10, 4 ], [ 4, 10 ], [ 4, 4 ], [ 16, 16 ], [ 4, 16 ], [ 16, 4] ],
[ [ 16, 10 ], [ 10, 4 ], [ 10, 16 ], [ 4, 10 ], [ 4, 4 ], [ 16, 16 ], [ 4, 16 ], [ 16, 4] ],
[ [ 10, 10 ], [ 16, 10 ], [ 10, 4 ], [ 10, 16 ], [ 4, 10 ], [ 4, 4 ], [ 16, 16 ], [ 4, 16 ], [ 16, 4] ],
]
};
class Point { class Point {
constructor(x, y, Game) { constructor(x, y, Game) {

View file

@ -0,0 +1,9 @@
const chai = require('chai');
const should = chai.should();
const Game = require('../services/Game');
describe('Game', () => {
it('init Game', done => {
done();
})
})

View file

@ -32,10 +32,8 @@ describe('game services', () => {
gameServices.initGame({ id: 1, handicap:4 }); gameServices.initGame({ id: 1, handicap:4 });
const afterMoveOne = gameServices.makeMove({ id: 1 }, { player: 'white', pos: { x: 4, y: 3 } }); const afterMoveOne = gameServices.makeMove({ id: 1 }, { player: 'white', pos: { x: 4, y: 3 } });
afterMoveOne.should.not.eql(fourHandicapBoard); afterMoveOne.should.not.eql(fourHandicapBoard);
console.log (afterMoveOne)
done(); done();
}) })
}) })