Created
March 29, 2018 16:13
-
-
Save JohnnyBizzel/a85c6a805e20d41ffb268430876e0686 to your computer and use it in GitHub Desktop.
Poker hand tester for poker-comparer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>POKER TEST</title> | |
<meta name="description" content="DESCRIPTION"> | |
</head> | |
<body> | |
Result of test: { "win": 1, "loss": 2, "tie": 3 }; | |
<br/> | |
RESULT: <p id="app"></p> | |
<br/> | |
<label for="playerHand">Player:</label> <input id="txtPlayerHand" name="playerHand" type="text"></input><br/> | |
<label for="opptHand">Oppt:</label> <input id="txtOpptHand" name="opptHand" type="text"></input> | |
<br/> | |
<button onclick="checkHands();">Check winner</button> | |
<br/> | |
<label id="playerHand"></label><span> (Player) </span> | |
<p></p> | |
<label id="opHand"></label><span> (opponent) </span> | |
<!-- <script src="RankPoker.js"></script> --> | |
<script src="Charlie-poker/pokerhands-comparison.js"></script> | |
<script type="text/javascript"> | |
checkHands(); | |
function checkHands() { | |
var player = "2C 3C 4C 5C AC"; | |
var opponent = "TS JS QS KS AS"; | |
if (document.getElementById("txtPlayerHand").value) { | |
player = document.getElementById("txtPlayerHand").value; | |
} | |
if (document.getElementById("txtOpptHand").value) { | |
opponent = document.getElementById("txtOpptHand").value; | |
} | |
var p = new PokerHand(player); | |
var o = new PokerHand(opponent); | |
p.compareWith(o); | |
document.getElementById("playerHand").innerHTML = player; | |
document.getElementById("opHand").innerHTML = opponent; | |
document.getElementById("app").innerHTML = JSON.stringify(p.compareWith(o)); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Comparer script reference is on line 26