| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 | 
							- <script type="text/javascript">
 
-     var crapsComponent = new Vue({
 
-         el: '#crapsComponent',
 
-         delimiters: ['@{{', '}}'],
 
-         data: {
 
-             game: false,
 
-             chips: [1, 5, 10, 25, 50, 100],
 
-             total: 10000,
 
-             max: 2000,
 
-             bet: 0,
 
-             selectedChip: 1,
 
-             alert: 'Place your bets by clicking on the Pass Line',
 
-             comeAlert: '',
 
-             passChipCount: 0,
 
-             passchips: [],
 
-             passPoint: 0,
 
-             comeChipCount: 0,
 
-             currentComeChips: [],
 
-             comePoints: [],
 
-             oddsChipCount: 0,
 
-             oddschips: [],
 
-             oddsAlert: '',
 
-             rolledOnce: false,
 
-             rolled: false,
 
-             rollCount: 0,
 
-             dice1Text: 'fas fa-dice-two',
 
-             dice2Text: 'fas fa-dice-three',
 
-         },
 
-         methods: {
 
-             currencyFormat: function(_num) {
 
-                 var formatter = new Intl.NumberFormat('en-US', {
 
-                     style: 'currency',
 
-                     currency: 'USD',
 
-                 });
 
-                 return formatter.format(_num);
 
-             },
 
-             onPassLine: function() {
 
-                 var self = this;
 
-                 if (self.passPoint) return;
 
-                 self.game = true;
 
-                 self.comeAlert = '';
 
-                 self.alert = 'Place your bets by clicking on the Pass Line';
 
-                 self.passChipCount += self.selectedChip;
 
-                 if (self.passchips.indexOf(self.selectedChip) <= -1) {
 
-                     self.passchips.push(self.selectedChip);
 
-                 };
 
-                 self.totalCounter();
 
-             },
 
-             onComeLine: function() {
 
-                 var self = this;
 
-                 if (!self.passPoint) return;
 
-                 self.game = true;
 
-                 self.comeAlert = 'Place new bets by clicking on the COME';
 
-                 self.comeChipCount += self.selectedChip;
 
-                 if (self.currentComeChips.indexOf(self.selectedChip) <= -1) {
 
-                     self.currentComeChips.push(self.selectedChip);
 
-                 };
 
-                 self.totalCounter();
 
-             },
 
-             onOddsLine: function() {
 
-                 var self = this;
 
-                 if (!self.passPoint) return;
 
-                 self.oddsAlert = "";
 
-                 var max = self.passChipCount * 3;
 
-                 if (self.selectedChip > max || (self.oddsChipCount + self.selectedChip) > max) {
 
-                     self.oddschips = self.passchips;
 
-                     self.oddsChipCount = max;
 
-                     self.oddsAlert = "Max odds bet reached! (x3 of your pass bet)";
 
-                 } else {
 
-                     self.oddsChipCount += self.selectedChip;
 
-                     if (self.oddschips.indexOf(self.selectedChip) <= -1) {
 
-                         self.oddschips.push(self.selectedChip);
 
-                     };
 
-                 }
 
-                 self.totalCounter();
 
-             },
 
-             resetGame: function() {
 
-                 var self = this;
 
-                 self.passchips = [];
 
-                 self.passChipCount = 0;
 
-                 self.passPoint = 0;
 
-                 self.oddschips = [];
 
-                 self.oddsChipCount = 0;
 
-                 self.total = 10000;
 
-                 self.rolled = false;
 
-                 setTimeout(function() {
 
-                     if (self.comePoints.length == 0) {
 
-                         self.game = false;
 
-                     };
 
-                 }, 1)
 
-             },
 
-             resetComeGame: function() {
 
-                 var self = this;
 
-                 self.currentComeChips = [];
 
-                 self.comeChipCount = 0;
 
-                 self.currentComeChips = [];
 
-                 self.comePoints = [];
 
-             },
 
-             resetOddsGame: function () {
 
-               var self = this;
 
-               self.oddsChipCount = 0;
 
-               self.oddschips = [];
 
-             },
 
-             onRollDice: function() {
 
-                 var self = this;
 
-                 self.rolledOnce = true;
 
-                 self.rolled = true;
 
-                 self.dice1 = Math.floor(Math.random() * 6) + 1;
 
-                 self.dice2 = Math.floor(Math.random() * 6) + 1;
 
-                 self.dice1Text = 'fas fa-dice-' + self.numtoString(self.dice1);
 
-                 self.dice2Text = 'fas fa-dice-' + self.numtoString(self.dice2);
 
-                 if (!self.passPoint || self.comePoints.length > 1) {
 
-                     self.passGame();
 
-                 } else {
 
-                     self.mainGame();
 
-                 }
 
-             },
 
-             numtoString: function(_num) {
 
-                 switch (_num) {
 
-                     case 1:
 
-                         return 'one';
 
-                         break;
 
-                     case 2:
 
-                         return 'two';
 
-                         break;
 
-                     case 3:
 
-                         return 'three';
 
-                         break;
 
-                     case 4:
 
-                         return 'four';
 
-                         break;
 
-                     case 5:
 
-                         return 'five';
 
-                         break;
 
-                     case 6:
 
-                         return 'six';
 
-                         break;
 
-                 }
 
-             },
 
-             passGame: function() {
 
-                 var self = this;
 
-                 if (self.comePoints.length > 0) {
 
-                     self.mainGame();
 
-                 };
 
-                 self.oddsAlert = '';
 
-                 if (self.passChipCount == 0) return;
 
-                 var totalDice = self.dice1 + self.dice2;
 
-                 if (totalDice == 7 || totalDice == 11) {
 
-                     self.alert = 'Game Won! You rolled ' + totalDice;
 
-                     self.resetGame();
 
-                 } else if (totalDice == 2 || totalDice == 3 || totalDice == 12) {
 
-                     self.alert = 'Game Lost! You rolled ' + totalDice;
 
-                     self.resetGame();
 
-                 } else {
 
-                     self.passPoint = totalDice;
 
-                     self.alert = "Roll the dice until you get " + self.passPoint + " to win";
 
-                 }
 
-             },
 
-             mainGame: function() {
 
-                 var self = this;
 
-                 var totalDice = self.dice1 + self.dice2;
 
-                 if (self.passChipCount > 0) { //ensure pass game is ongoing
 
-                     if (totalDice == self.passPoint) {
 
-                         self.alert = 'Game Won! You rolled ' + totalDice;
 
-                         if (self.oddsChipCount > 0) {
 
-                             self.oddsGame();
 
-                         }else {
 
-                           self.resetGame();
 
-                         }
 
-                     } else if (totalDice == 7) {
 
-                         self.alert = 'Game Lost! You rolled ' + totalDice;
 
-                         if (self.oddsChipCount > 0) {
 
-                             self.oddsGame();
 
-                         }else {
 
-                           self.resetGame();
 
-                         }
 
-                     };
 
-                 };
 
-                 if (self.comePoints.length > 0) {
 
-                     self.comeAlert = '';
 
-                     var multipleAlerts = [];
 
-                     for (var i = 0; i < self.comePoints.length; i++) {
 
-                         if (totalDice == self.comePoints[i].move) {
 
-                             multipleAlerts.push('Come Game Won! You rolled ' + totalDice);
 
-                             self.comePoints.splice(i, 1);
 
-                         } else if (totalDice == 7) {
 
-                             multipleAlerts.push('Come Game Lost! You rolled ' + totalDice);
 
-                             self.comePoints.splice(i, 1);
 
-                         } else {
 
-                             multipleAlerts.push("Roll the dice until you also get " + self.comePoints[i].move + " to win");
 
-                         };
 
-                     };
 
-                     self.comeAlert = multipleAlerts.toString();
 
-                 };
 
-                 if (self.comePoints.length == 0 && !self.passPoint) {
 
-                     self.resetGame();
 
-                 }
 
-                 if (self.comeChipCount > 0) {
 
-                     self.comeGame(totalDice);
 
-                 }
 
-             },
 
-             comeGame: function(_totalDice) {
 
-                 var self = this;
 
-                 if (self.currentComeChips.length > 0) {
 
-                     if (_totalDice == 7 || _totalDice == 11) {
 
-                         self.comeAlert = 'Come Game Won! You rolled ' + _totalDice + '\n';
 
-                         if (self.comePoints.length == 0) {
 
-                             self.resetComeGame();
 
-                         }
 
-                     } else if (_totalDice == 2 || _totalDice == 3 || _totalDice == 12) {
 
-                         self.comeAlert = 'Come Game Lost! You rolled ' + _totalDice + '\n';
 
-                         if (self.comePoints.length == 0) {
 
-                             self.resetComeGame();
 
-                         }
 
-                     } else {
 
-                         var obj = {
 
-                             move: _totalDice,
 
-                             chipCount: self.comeChipCount
 
-                         };
 
-                         self.comePoints.push(obj);
 
-                         self.comeAlert = "Roll the dice until you also get " + _totalDice + " to win";
 
-                         self.comeChipCount = 0;
 
-                     };
 
-                 }
 
-             },
 
-             oddsGame: function() {
 
-                 var self = this;
 
-                 if (self.oddsChipCount == 0) return;
 
-                 var totalDice = self.dice1 + self.dice2;
 
-                 if (totalDice == self.passPoint) {
 
-                     self.oddsAlert = 'Odds Game Won! You rolled ' + totalDice;
 
-                     self.resetGame();
 
-                 } else if (totalDice == 7) {
 
-                     self.oddsAlert = 'Odds Game Lost! You rolled ' + totalDice;
 
-                     self.resetGame();
 
-                 } else {
 
-                     self.oddsAlert = "Win you pass point to win your odds!";
 
-                 }
 
-             },
 
-             totalCounter: function() {
 
-                 var self = this;
 
-             }
 
-         },
 
-         mounted: function() {
 
-         }
 
-     });
 
- </script>
 
 
  |