fix komi suggestion bug, add style

This commit is contained in:
Sorrel Bri 2019-08-07 17:46:56 -07:00
parent bc79e3ca8e
commit 8299f02c42
3 changed files with 4 additions and 11 deletions

View file

@ -283,12 +283,9 @@ content {
#board-space { #board-space {
grid-area: board; grid-area: board;
margin: 0 auto; margin: 0 auto;
/* grid-area: board-space; */
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background-color: rgba(234, 178, 78, 1); background-color: rgba(234, 178, 78, 1);
/* width: 90vmin; */
/* height: 90vmin; */
padding: 1vmin; padding: 1vmin;
z-index: 1; z-index: 1;
box-shadow: -2vmin 4vmin 3vmin rgba(145, 92, 23, 0.5); box-shadow: -2vmin 4vmin 3vmin rgba(145, 92, 23, 0.5);
@ -300,8 +297,6 @@ content {
display: flex; display: flex;
align-items: stretch; align-items: stretch;
justify-content: space-between; justify-content: space-between;
height: 81vmin;
width: 81min;
margin: auto; margin: auto;
} }

View file

@ -22,7 +22,7 @@
<div class="menu-subblock"><span class="menu-heading">Komi:</span><span id="komi"></span></div> <div class="menu-subblock"><span class="menu-heading">Komi:</span><span id="komi"></span></div>
<input type="range" min="-21.5" max="7.5" step="1" value="5.5" name="komi-slider"> <input type="range" min="-21.5" max="7.5" step="1" value="5.5" name="komi-slider">
<div class="menu-subblock"><span class="menu-heading">Handicap:</span><span id="handicap"></span></div> <div class="menu-subblock"><span class="menu-heading">Handicap:</span><span id="handicap"></span></div>
<input type="range" min="0" max="5" step="1" value="0" name="handicap-slider"> <input type="range" min="0" max="9" step="1" value="0" name="handicap-slider">
<div id="board-size-radio" class="menu-subblock"> <div id="board-size-radio" class="menu-subblock">
<p class="menu-heading">Board Size</p> <p class="menu-heading">Board Size</p>
<input type="radio" name="board-size" value="9" checked>9 x 9<br> <input type="radio" name="board-size" value="9" checked>9 x 9<br>

View file

@ -267,14 +267,14 @@ init();
let findPointFromIdx = (arr) => boardState.find( point => point.pos[0] === arr[0] && point.pos[1] === arr[1] ); let findPointFromIdx = (arr) => boardState.find( point => point.pos[0] === arr[0] && point.pos[1] === arr[1] );
function changeUpdateKomi() { function changeUpdateKomi(evt) {
evt.stopPropagation(); evt.stopPropagation();
komiDisplayEl.textContent = komiSliderEl.value; komiDisplayEl.textContent = komiSliderEl.value;
gameState.komi = komiSliderEl.value; gameState.komi = komiSliderEl.value;
renderMenu(); renderMenu();
} }
function changeUpdateHandicap() { function changeUpdateHandicap(evt) {
evt.stopPropagation(); evt.stopPropagation();
handiDisplayEl.textContent = handiSliderEl.value !== 1 ? handiSliderEl.value : 0; handiDisplayEl.textContent = handiSliderEl.value !== 1 ? handiSliderEl.value : 0;
gameState.handicap = handiSliderEl.value !== 1 ? handiSliderEl.value : 0; gameState.handicap = handiSliderEl.value !== 1 ? handiSliderEl.value : 0;
@ -307,7 +307,7 @@ function clickUpdatePlayerMeta(evt) {
function clickBoardSize(evt) { function clickBoardSize(evt) {
evt.stopPropagation(); evt.stopPropagation();
gameState.boardSize = boardSizeEl.value; gameState.boardSize = document.querySelector('#board-size-radio [checked]').value;
renderMenu(); renderMenu();
} }
@ -617,7 +617,6 @@ function renderPreview(hoverPoint) {
} }
function calculateWinner() { function calculateWinner() {
// debugger;
let whiteTerritory = boardState.reduce((acc, pt) => { let whiteTerritory = boardState.reduce((acc, pt) => {
if (pt.territory === -1 && pt.stone !== -1) { if (pt.territory === -1 && pt.stone !== -1) {
return acc = acc + (pt.stone === 0 ? 1 : 2); return acc = acc + (pt.stone === 0 ? 1 : 2);
@ -653,7 +652,6 @@ function endGameSetTerritory() {
function groupsMarkDeadLive() { function groupsMarkDeadLive() {
boardState.filter(pt => (!pt.territory )) boardState.filter(pt => (!pt.territory ))
.forEach(pt => { .forEach(pt => {
debugger;
if (pt.groupMembers.some(grpMem => { if (pt.groupMembers.some(grpMem => {
return grpMem.checkNeighbors().some(nbr => nbr.territory === pt.stone && nbr.stone === 0) return grpMem.checkNeighbors().some(nbr => nbr.territory === pt.stone && nbr.stone === 0)
})) { })) {