JSFiddle - React, Tailwind, and code Playground
by guyluchenbill
HTML
<p>How many players?</p>
<input type='text' id='players' /><br />
<input type='submit' value='Seat Players' id='createPlayers' /><br />
<input type='submit' value='Shuffle Up & Deal' id='dealCards' /><br />
<input type='submit' value='Deal Flop' id='dealFlop' /><br />
<input type='submit' value='Deal Turn' id='dealTurn' /><br />
<input type='submit' value='Deal River' id='dealRiver' /><br />
<div>
<p>Here's the flop!</p>
<p id='cardsOutput'></p>
</div>
<div id="playerOutput">
</div>
<div id="cardsOutput">
</div>
JavaScript
var $ = function(id) {
return document.getElementById(id);
};
Array.prototype.shuffle = function() {
var len = this.length, i = len;
while (i--) {
var p = parseInt(Math.random()*len), t = this[i];
this[i] = this[p];
this[p] = t;
}
};
var i = [1,2,3];
i.pop();
console.log(i);
i.shuffle;
console.log(i);
var Players = function() {
};
Players.prototype = {
constructor: Players,
createPlayers: function() {
},
addPlayers: function() {
},
removePlayer: function() {
}
};
var Cards = function() {
};
Cards.prototype = {
constructor: Cards,
buildDeck: function() {
},
shuffleDeck: function() {
},
dealFlop: function() {
},
dealTurn: function() {
},
dealRiver: function() {
var z = [1,2,3].shuffle();
console.log(z);
}
};
var x = new Cards();
$('dealRiver').addEventListener('click', x.dealRiver, false);