const LetterScore = { 'A':1,'E':1,'I':1,'L':1,'N':1,'O':1,'R':1,'S':1,'T':1,'U':1, 'D':2, 'G':2, 'B':2, 'C':2, 'M':3, 'P':3, 'F':4, 'H':4, 'V':4, 'W':4, 'Y':4, 'K':5, 'J':8, 'X':8, 'Q':10, 'Z':10, }; function getLetterScore(text) { let L = text.toUpperCase(); return LetterScore[L] || 0; for (var i=0; i= 4); } function BigWord(word) { return (word.length >= 6); } function NumVowels(str) { // Define a regular expression for vowels const vowelRegex = /[aeiouAEIOU]/g; // Match the vowels in the string const matches = str.match(vowelRegex); // Return the number of matches, or 0 if there are no matches return matches ? matches.length : 0; } function Joker1_Eval(context, word) { if (MediumWord(word)) { context.mult += 1; return true; } return false; } function Joker2_Eval(context, word) { if (NumVowels(word) != 0) { context.mult += 1; return true; } return false; } function getBaseScore(word) { let score = 0; for (var i=0; i${emoji}
${name}
`; return item; } function createOpponent(tag,iClass) { let name = tag.name; let emoji = tag.emoji; let item = document.createElement('div'); item.className = iClass; item.innerHTML = `
Select
Score: 32
${emoji}
`; // TODO: selectOpponent(); item.addEventListener('click', () => { selectOpponent(tag); }); const list = document.querySelector('.opponent-list'); list.appendChild(item); return item; } let Faces = [ "👶", // Baby "🤓", // Nerd "🤠", // Cowboy "👨", // Man "👩", // Woman "😺", // Cat "👩‍⚕️", // Nurse "👨‍💻", // Tech "🧝", // Elf "👮", // Police "👳", // Turban "🕵", // Detective "🤴", // Prince "🤵", // Tuxedo "🧔", // Beard "🧙", // Wizard "👱", // Blonde //"🧟", // Zombie ]; let Bosses = [ "👽", // Alien "😈", // Demon "👻", // Ghost "🤖", // Robot "👹", // Goblin "🤡", // Clown "🧛", // Vampire "🦹", // Villain "💀", // Skull "🃏", // Joker ]; // i.e. Small Blind let Mini_01 = { score:12, name:"Baby", emoji:"👶" }; let Mini_02 = { score:12, name:"Panda", emoji:"🐼" }; let Mini_03 = { score:12, name:"Kitty", emoji:"😺" }; let Mini_04 = { score:12, name:"Doggy", emoji:"🐶" }; let Mini_05 = { score:12, name:"Fox", emoji:"🦊" }; let Mini_06 = { score:12, name:"Rabbit",emoji:"🐰" }; let Mini_07 = { score:12, name:"Monkey",emoji:"🐵" }; let Mini_08 = { score:12, name:"Mouse", emoji:"🐭" }; // i.e. Big Blind let Opp_01 = { score:20, name:"Wizard", emoji:"🧙" }; let Opp_02 = { score:20, name:"Elf", emoji:"🧝" }; let Opp_03 = { score:20, name:"Nerd", emoji:"🤓" }; let Opp_04 = { score:20, name:"Cowboy", emoji:"🤠" }; let Opp_05 = { score:20, name:"Man", emoji:"👨" }; let Opp_06 = { score:20, name:"Woman", emoji:"👩" }; let Opp_07 = { score:20, name:"Beard", emoji:"🧔" }; let Opp_08 = { score:20, name:"Blonde", emoji:"👱" }; let Opp_09 = { score:20, name:"Police", emoji:"👮" }; let Opp_10 = { score:20, name:"Turban", emoji:"👳" }; let Opp_11 = { score:20, name:"Prince", emoji:"🤴" }; let Opp_12 = { score:20, name:"Tuxedo", emoji:"🤵" }; let Opp_13 = { score:20, name:"Detective", emoji:"🕵" }; let Opp_14 = { score:20, name:"Nurse", emoji:"👩‍⚕️" }; let Opp_15 = { score:20, name:"Tech", emoji:"👨‍💻" }; // i.e Boss Blind let Boss_01 = { score:40, name:"Alien Boss", emoji:"👽" }; let Boss_02 = { score:40, name:"Demon Boss", emoji:"😈" }; let Boss_03 = { score:40, name:"Ghost Boss", emoji:"👻" }; let Boss_04 = { score:40, name:"Robot Boss", emoji:"🤖" }; let Boss_05 = { score:40, name:"Goblin Boss", emoji:"👹" }; let Boss_06 = { score:40, name:"Clown Boss", emoji:"🤡" }; let Boss_07 = { score:40, name:"Vampire Boss",emoji:"🧛" }; let Boss_08 = { score:40, name:"Villain Boss",emoji:"🦹" }; let Boss_09 = { score:40, name:"Skull Boss", emoji:"💀" }; let Boss_10 = { score:40, name:"Joker Boss", emoji:"🃏" }; let NewSmall = [ Mini_01, Mini_02, Mini_03, Mini_04, Mini_05, Mini_06, Mini_07, Mini_08, ]; let NewFaces = [ Opp_01, Opp_02, Opp_03, Opp_04, Opp_05, Opp_06, Opp_07, Opp_08, Opp_09, Opp_10, Opp_11, Opp_12, ]; let NewBosses = [ Boss_01, Boss_02, Boss_03, Boss_04, Boss_05, Boss_06, Boss_07, Boss_08, Boss_09, Boss_10, ]; let Wizard = Opp_01; for (let i=0; i<3; ++i) { let Who = (i==0) ? NewSmall : (i<2 ? NewFaces : NewBosses); let opp = Math.floor(Math.random()*Who.length); createOpponent(Who[opp],'opponent'); Who.splice(opp,1); } const shopContainer = document.querySelector('.shop-tiles'); let shopCart = [ Wild_01, Wild_02, Wild_03, Wild_04 ]; let shopWidget = null; function PlayerHas(item) { // Try to avoid duplicates? for (let has of PlayerWildcards) { if (has === item) { return true; } } return false; } function BuildShop(doc) { shopContainer.innerHTML = ''; for (let item of shopCart) { if (PlayerHas(item)) { continue; } let widget = createWildcard(item); widget.addEventListener('click',()=>{toggleBuyButton(widget);}); //widget.addEventListener('click', (function(p){ //return function(){buyWildcard(p);} //})(item)); let buy = widget.querySelector('.buyTag'); buy.addEventListener('click',()=>{buyWildcard(item);}); shopContainer.appendChild(widget); } } function setShopFocus(widget) { if (widget !== shopWidget) { if (shopWidget !== null) { hideBuyButton(shopWidget); shopWidget = null; } if (widget !== null) { showBuyButton(widget); shopWidget = widget; } } } function toggleBuyButton(widget) { let buy = widget.querySelector('.buyTag'); if (buy.style.opacity > 0) { buy.style.opacity = 0; buy.style.visibility = 'none'; setShopFocus(null); } else { setShopFocus(widget); } } function hideBuyButton(widget) { let buy = widget.querySelector('.buyTag'); buy.style.opacity = 0; buy.style.visibility = 'none'; } function showBuyButton(widget) { if (widget !== null) { let buy = widget.querySelector('.buyTag'); buy.style.opacity = 1; buy.style.visibility = 'block'; // aka visible } } function buyWildcard(wild) { shopCart = shopCart.filter(it => it !== wild); PlayerWildcards.push(wild); showWildcard(wild); BuildShop(document); } const canvas = document.getElementById('bg-canvas'); const ctx = canvas.getContext('2d'); function resizeCanvas() { canvas.width = window.innerWidth; canvas.height = window.innerHeight; } function animate() { // Example animation: moving dots ctx.fillStyle = 'rgba(120, 64, 120, 0.1)'; //ctx.fillRect(0, 0, canvas.width, canvas.height); if (Math.random() < 1) { // Draw something here const x = Math.random() * canvas.width; const y = Math.random() * canvas.height; const r = Math.floor(Math.random() * 64); const g = 32; const b = 64; ctx.fillStyle = `rgba(${r},${g},${b},0.33)`; ctx.beginPath(); ctx.arc(x, y, 128, 0, Math.PI * 2); ctx.fill(); } requestAnimationFrame(animate); } window.addEventListener('resize', resizeCanvas); resizeCanvas(); animate();