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

View file

@ -22,7 +22,7 @@
<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">
<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">
<p class="menu-heading">Board Size</p>
<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] );
function changeUpdateKomi() {
function changeUpdateKomi(evt) {
evt.stopPropagation();
komiDisplayEl.textContent = komiSliderEl.value;
gameState.komi = komiSliderEl.value;
renderMenu();
}
function changeUpdateHandicap() {
function changeUpdateHandicap(evt) {
evt.stopPropagation();
handiDisplayEl.textContent = handiSliderEl.value !== 1 ? handiSliderEl.value : 0;
gameState.handicap = handiSliderEl.value !== 1 ? handiSliderEl.value : 0;
@ -307,7 +307,7 @@ function clickUpdatePlayerMeta(evt) {
function clickBoardSize(evt) {
evt.stopPropagation();
gameState.boardSize = boardSizeEl.value;
gameState.boardSize = document.querySelector('#board-size-radio [checked]').value;
renderMenu();
}
@ -617,7 +617,6 @@ function renderPreview(hoverPoint) {
}
function calculateWinner() {
// debugger;
let whiteTerritory = boardState.reduce((acc, pt) => {
if (pt.territory === -1 && pt.stone !== -1) {
return acc = acc + (pt.stone === 0 ? 1 : 2);
@ -653,7 +652,6 @@ function endGameSetTerritory() {
function groupsMarkDeadLive() {
boardState.filter(pt => (!pt.territory ))
.forEach(pt => {
debugger;
if (pt.groupMembers.some(grpMem => {
return grpMem.checkNeighbors().some(nbr => nbr.territory === pt.stone && nbr.stone === 0)
})) {