weight everything equally
This commit is contained in:
parent
8c18c7a475
commit
db0567b04e
|
@ -1,8 +1,7 @@
|
||||||
mode = 'PLAY'
|
mode = 'PLAY'
|
||||||
allData = {}
|
allData = {}
|
||||||
total = 0
|
total = 0
|
||||||
weightedCards = []
|
cardNames = []
|
||||||
indWeighedCards = 0
|
|
||||||
k = 12
|
k = 12
|
||||||
extra = 3
|
extra = 3
|
||||||
artDict = {}
|
artDict = {}
|
||||||
|
@ -54,15 +53,7 @@ function putIntoMapAndFetch(data) {
|
||||||
allData = newArtistData[0]
|
allData = newArtistData[0]
|
||||||
total = newArtistData[1]
|
total = newArtistData[1]
|
||||||
}
|
}
|
||||||
for (const [key, value] of Object.entries(allData)) {
|
cardNames = Array.from(Object.keys(allData))
|
||||||
if (whichGuesser == 'artist') {
|
|
||||||
weightedCards.push(key)
|
|
||||||
} else {
|
|
||||||
for (let j = 0; j < value.length; j++) {
|
|
||||||
weightedCards.push(key)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
window.console.log(allData)
|
window.console.log(allData)
|
||||||
window.console.log(total)
|
window.console.log(total)
|
||||||
if (whichGuesser === 'counterspell') {
|
if (whichGuesser === 'counterspell') {
|
||||||
|
@ -86,17 +77,9 @@ function getKSamples() {
|
||||||
let usedCounters = new Set()
|
let usedCounters = new Set()
|
||||||
let samples = {}
|
let samples = {}
|
||||||
let i = 0
|
let i = 0
|
||||||
let allCards = []
|
let allCards = Array.from(Object.keys(allData))
|
||||||
if (whichGuesser == 'artist') {
|
|
||||||
allCards = weightedCards
|
|
||||||
} else {
|
|
||||||
for (const [key, value] of Object.entries(allData)) {
|
|
||||||
for (let j = 0; j < value.length; j++) {
|
|
||||||
allCards.push(key)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
shuffleArray(allCards)
|
shuffleArray(allCards)
|
||||||
|
window.console.log(allCards)
|
||||||
for (let j = 0; j < allCards.length; j++) {
|
for (let j = 0; j < allCards.length; j++) {
|
||||||
key = allCards[j]
|
key = allCards[j]
|
||||||
value = allData[key]
|
value = allData[key]
|
||||||
|
@ -120,13 +103,13 @@ function getKSamples() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (whichGuesser == 'artist') {
|
if (whichGuesser == 'artist') {
|
||||||
usedCounters = new Set(weightedCards)
|
usedCounters = new Set(cardNames)
|
||||||
} else {
|
} else {
|
||||||
let count = 0
|
let count = 0
|
||||||
shuffleArray(weightedCards)
|
shuffleArray(cardNames)
|
||||||
for (let j = 0; j < weightedCards.length; j++) {
|
for (let j = 0; j < cardNames.length; j++) {
|
||||||
key = weightedCards[j]
|
key = cardNames[j]
|
||||||
value = weightedCards[key]
|
value = cardNames[key]
|
||||||
if (usedCounters.has(key)) {
|
if (usedCounters.has(key)) {
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
|
@ -283,9 +266,7 @@ function setUpNewGame() {
|
||||||
|
|
||||||
setWordsLeft()
|
setWordsLeft()
|
||||||
// select new cards
|
// select new cards
|
||||||
window.console.log(k)
|
|
||||||
let sampledData = getKSamples()
|
let sampledData = getKSamples()
|
||||||
window.console.log(k)
|
|
||||||
artDict = sampledData[0]
|
artDict = sampledData[0]
|
||||||
let randomImages = Object.keys(artDict)
|
let randomImages = Object.keys(artDict)
|
||||||
shuffleArray(randomImages)
|
shuffleArray(randomImages)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user