Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ module.exports = {
// Allow function param reassign for array or object elements or properties
'no-param-reassign': ['error', { props: false }],
},
options: {
'prefer-const': ['error', {
destructuring: 'any',
ignoreReadBeforeAssign: false,
}],
},
};
Binary file added assets/fonts/Comic Sans MS.ttf
Binary file not shown.
69 changes: 69 additions & 0 deletions global.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
GLOBAL VARIABLES
*/

// User starts with 100 points
let userPoints = 100;

// User chooses how much they want to bet, 1 by default;
let userBet = 1;

let canDeal = true;
let canSwap = true;

let cardContainer;

// User is dealt 5 cards
let userHand = [];

// Current deck
let cardDeck = [];

let cardClick = [true, true, true, true, true];

// User chosen cards to swap
let cardsToSwap = [];

// User's winning condition on hand
let userWin = "";

const gameContainer = document.createElement('div');
gameContainer.classList.add('game-container');
document.body.appendChild(gameContainer);

pointsContainer = document.createElement('div');
pointsContainer.classList.add('points');
pointsContainer.innerText = `You have: ${userPoints} points`;
gameContainer.appendChild(pointsContainer);

cardContainer = document.createElement('div');
cardContainer.classList.add('card-container');
gameContainer.appendChild(cardContainer);

// Message
const gameInfo = document.createElement('div');
gameInfo.classList.add('message');
gameContainer.appendChild(gameInfo);

const buttons = document.createElement('div');
buttons.classList.add('buttons');
gameContainer.appendChild(buttons);

// Deal button
const dealButton = document.createElement('button');
dealButton.innerText = 'DEAL';
buttons.appendChild(dealButton);

// Swap button
const swapButton = document.createElement('button');
swapButton.innerText = "SWAP";
buttons.appendChild(swapButton);

// Reset game button
const resetButton = document.createElement('button');
resetButton.innerText = "RESET";
buttons.appendChild(resetButton);

const cardBack = document.createElement('div');
cardBack.classList.add('card-back');
cardBack.innerHTML = "Be a quitter :" + "<br/>" + "1800-6-668-668";
Comment on lines +30 to +69

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider putting this in a function (eg, buildBoard)in script.js instead

Loading