Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b80f3f1
scaffold
noellimx Jan 18, 2022
fb53804
refine comments
noellimx Jan 18, 2022
cd776e7
add player
noellimx Jan 18, 2022
fe5a406
create some properties for cards in player hand
noellimx Jan 18, 2022
2f547e5
massive
noellimx Jan 19, 2022
953f32f
isHandFullHouse
noellimx Jan 19, 2022
ffcd42a
cal score for trips straight double
noellimx Jan 19, 2022
6145e06
testCardScoreShouldBeHigh testCardScoreShouldBePair testCardScoreShou…
noellimx Jan 19, 2022
79c0368
comment
noellimx Jan 19, 2022
4657639
testSingleSuitDeckProbabilities
noellimx Jan 19, 2022
d865ad8
testTopCombinationShouldBeHighestStraightFlush
noellimx Jan 20, 2022
4df79f1
display name during config
noellimx Jan 21, 2022
c8c0ac7
-
noellimx Jan 21, 2022
397ae71
-
noellimx Jan 21, 2022
229c9f6
refactor: group money and name as properties of players
noellimx Jan 21, 2022
98d6f2e
-
noellimx Jan 22, 2022
6d7bf64
finally, scaffolded cards display
noellimx Jan 22, 2022
39c80d0
show card img
noellimx Jan 22, 2022
7fa3be6
bet button
noellimx Jan 22, 2022
b4c4230
scoring after bet round 3
noellimx Jan 22, 2022
305f46c
standard deck sets to shuffle
noellimx Jan 22, 2022
9517bd7
Fix test: the logic to compare within straightflushes and within stra…
noellimx Jan 24, 2022
c1bb633
remove all console.log and console.group due to performance hit
noellimx Jan 24, 2022
70a8761
add test for jacks or better scoring
noellimx Jan 25, 2022
4609928
user able to toggle probability calculation
noellimx Jan 25, 2022
e3b269e
Include Bootstrap Bundle
noellimx Jan 25, 2022
6a46c87
partial styling of name components
noellimx Jan 25, 2022
010719c
Logic Fix for probability given some revealed cards : we should be l…
noellimx Jan 25, 2022
fe86560
rename functions to reflect previous commit
noellimx Jan 25, 2022
023eb04
Optimization to get best hand: @see ______WARN_setSimpleBestHandCombi…
noellimx Jan 25, 2022
ebdd1b4
Refactor: Memoize: prepare bags for helpers in advance, instead of in…
noellimx Jan 25, 2022
1330f2f
style
noellimx Jan 25, 2022
6786e78
pretty
noellimx Jan 25, 2022
febcdbc
sprint
noellimx Jan 25, 2022
78937e8
sprint
noellimx Jan 25, 2022
e1b7b1b
sprint
noellimx Jan 26, 2022
0af49f9
sprint
noellimx Jan 26, 2022
ad7fd62
sprint
noellimx Jan 26, 2022
040f396
Merge pull request #1 from noellimx/gammatest
noellimx Jan 26, 2022
333817f
+readme
noellimx Feb 11, 2022
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
12 changes: 5 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@ module.exports = {
browser: true,
es2020: true,
},
extends: [
'airbnb-base',
],
extends: ["airbnb-base"],
parserOptions: {
ecmaVersion: 11,
},
rules: {
// Don't enforce control flow closing curly brace needs to be
// on same line as next control flow opening statement
'brace-style': 'off',
"brace-style": "off",
// Disable linebreak style to prevent ESLint errors on Windows line endings
// https://eslint.org/docs/rules/linebreak-style
'linebreak-style': 'off',
"linebreak-style": "off",
// Allow console for students to debug
'no-console': 'off',
"no-console": "off",
// Allow function param reassign for array or object elements or properties
'no-param-reassign': ['error', { props: false }],
"no-param-reassign": ["error", { props: false }],
},
};
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Rocket Academy Coding Bootcamp: Video Poker

# Github Pages
https://noellimx.github.io/video-poker-bootcamp/
38 changes: 38 additions & 0 deletions index-test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles/main.css" />
</head>

<body>
<div id="root" mode="test"></div>

<!-- Components -->
<script src="scripts/src/card.js"></script>
<script src="scripts/src/deck.js"></script>
<script src="scripts/src/player.js"></script>
<script src="scripts/src/scoring.js"></script>

<!-- Elements -->
<script src="scripts/src/elementHelpers/contentHelpers.js"></script>
<script src="scripts/src/elementHelpers/constructorHelpers.js"></script>
<script src="scripts/src/elementHelpers/eventHelpers.js"></script>
<script src="scripts/src/elementHelpers/compositeHelpers.js"></script>

<!-- Game -->
<script src="scripts/src/moment/outGame/playerConfig.js"></script>
<script src="scripts/src/moment/inGame/index.js"></script>
<script src="scripts/src/moment/inGame/gameStudSeven.js"></script>

<!-- Test -->

<script src="scripts/general-helpers.js"></script>
<script src="scripts/test/helpers.js"></script>
<script src="scripts/test/player.js"></script>
<script src="scripts/test/scoring.js"></script>
<script src="scripts/test/card.js"></script>
<script src="scripts/test/index.js"></script>

<script src="main.js"></script>
</body>
</html>
52 changes: 52 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<title>1️⃣ 6️⃣ 8️⃣ HUAT POKER</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
crossorigin="anonymous"
/>
<link rel="stylesheet" href="styles/form-input.css" />
<link rel="stylesheet" href="styles/main.css" />
</head>

<body>
<div id="root" class="poker-root" mode="demo"></div>

<!-- Components -->
<script src="scripts/src/card.js"></script>
<script src="scripts/src/deck.js"></script>
<script src="scripts/src/player.js"></script>
<script src="scripts/src/scoring.js"></script>

<!-- Elements -->
<script src="scripts/src/elementHelpers/contentHelpers.js"></script>
<script src="scripts/src/elementHelpers/constructorHelpers.js"></script>
<script src="scripts/src/elementHelpers/eventHelpers.js"></script>
<script src="scripts/src/elementHelpers/compositeHelpers.js"></script>

<!-- Game -->
<script src="scripts/src/moment/outGame/playerConfig.js"></script>
<script src="scripts/src/moment/inGame/index.js"></script>
<script src="scripts/src/moment/inGame/gameStudSeven.js"></script>

<!-- Test -->

<script src="scripts/general-helpers.js"></script>
<script src="scripts/test/helpers.js"></script>
<script src="scripts/test/player.js"></script>
<script src="scripts/test/scoring.js"></script>
<script src="scripts/test/card.js"></script>
<script src="scripts/test/index.js"></script>

<script src="main.js"></script>

<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"
></script>
</body>
</html>
61 changes: 61 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const MODES = {
TEST: `test`,
DEMO: `demo`,
};

const getMode = () => document.getElementById(`root`).getAttribute(`mode`);

const getDefaultElementRoot = () => document.getElementById(`root`);

/**
* @typedef {Object} Core
* @property {Player} player
* @property {HTMLElement} elementRoot
*
*/

const newCore = () => {
return {
player: newPlayer(),
elementRoot: getDefaultElementRoot(),
};
};

const getPlayerOfCore = (core) => core.player;
const getPlayerCreditOfCore = (core) => getPlayerCredit(core.player);
const minusPlayerCreditOfCore = (core, credit) =>
minusPlayerCredit(getPlayerOfCore(core), credit);
const addPlayerCreditOfCore = (core, credit) =>
addPlayerCredit(getPlayerOfCore(core), credit);
const getPlayerNameOfCore = (core) => getPlayerName(core.player);
const getElementRootOfCore = (core) => core.elementRoot;

// -------- START --------

(() => {
console.log(`START`);
const mode = getMode();
if (mode === MODES.TEST) {
TEST_ALL();
}
if (mode === MODES.DEMO) {
const core = newCore();

const imgLoading = document.createElement(`img`);
imgLoading.setAttribute(`src`, `./static/img/circleOfCards.gif`);
imgLoading.setAttribute(`alt`, `A loading page gif`);
imgLoading.setAttribute(
`credit`,
`https://tenor.com/view/gamble-cards-pokers-gif-7257796`
);

const imgLoadDiv = document.createElement(`div`);
imgLoadDiv.className += ` img-loading-div`;
appendChild(imgLoadDiv, imgLoading);
appendChild(core.elementRoot, imgLoadDiv);
setTimeout(() => {
detachAllChildren(core.elementRoot);
goToPlayerConfigPage(core);
}, 2000);
}
})();
37 changes: 37 additions & 0 deletions scripts/general-helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
*
* @param {*} arg
* @returns {boolean} returns true if argument is null or undefined.
*/
const isNoU = (arg) => arg === undefined || arg === null;

/**
*
* @param {[]<*>} args
* @returns
*/
const isAnyNoU = (...args) => args.some((arg) => isNoU(arg));

const incrementOneToObjProp = (obj, property) => {
if (typeof obj[property] !== `number`) {
if (isNoU(obj[property])) {
obj[property] = 0;
} else {
console.warn(
`[addOneToObjProp] the property ${property} of object is assigned to a non-scalar value.`
);
return;
}
}
obj[property] += 1;
};

/**
*
* @param {*} obj
* @param {Array<*>} prop
* @param {*} element
*/
const addElementToPropInObject = (obj, prop, element) => {
obj[prop].push(element);
};
Loading