fix multiple selections

master
Peter Babič 3 years ago
parent 69f2d25696
commit d0a743a71e
Signed by: peter.babic
GPG Key ID: 4BB075BC1884BA40
  1. 8
      src/App.svelte

@ -63,18 +63,22 @@
jumps.addEdge(11, 14)
const change = clicked => {
const indexOfPicked = state.indexOf(pickedPole)
const emptyHoles = [...state.keys()].filter(i => state[i] == emptyHole)
const possibleJumps = jumps.adjacencyList[clicked].filter(jump =>
emptyHoles.includes(jump)
)
if (state[clicked] == standingPole && possibleJumps.length > 0) {
if (
state[clicked] == standingPole &&
indexOfPicked == -1 &&
possibleJumps.length > 0
) {
state[clicked] = pickedPole
return
}
const indexOfPicked = state.indexOf(2)
const possibleMove = jumps.adjacencyList[clicked].filter(
jump => jump == indexOfPicked
)

Loading…
Cancel
Save