Javascript Martingale for dice games


SUBMITTED BY: Guest

DATE: Sept. 12, 2013, 2:29 p.m.

FORMAT: Text only

SIZE: 1.7 kB

HITS: 1101

  1. /*
  2. Commands:
  3. start() - Start the Martingale Bot
  4. stopNow() - Stop the Martingale Bot
  5. stopAfterWin() - Stop the Martingale Bot After Winning
  6. */
  7. //Settings
  8. var initialBet = "0.0000559";
  9. var chanceToWin = "70.0141";
  10. //Your don't need to change anything below here
  11. var payoutMultiplier;
  12. var martingaleMultiplier;
  13. var nextBet;
  14. var bStopNow = false;
  15. var bStopAfterWin = false;
  16. function start() {
  17. payoutMultiplier = 99/parseFloat(chanceToWin);
  18. martingaleMultiplier = payoutMultiplier/(payoutMultiplier-1);
  19. nextBet = parseFloat(initialBet);
  20. roll();
  21. }
  22. function stopNow() {
  23. bStopNow = true;
  24. }
  25. function stopAfterWin() {
  26. bStopAfterWin = true;
  27. }
  28. function roll() {
  29. var hi_lo = Math.round(Math.random());
  30. if (hi_lo == 0)
  31. hi_lo = 'hi';
  32. else
  33. hi_lo = 'hi';
  34. socket.emit("bet", csrf, {
  35. chance: chanceToWin,
  36. bet: nextBet.toFixed(8),
  37. which: hi_lo
  38. });
  39. }
  40. if (!window.botInitialized) {
  41. socket.on("wins", function (data) {
  42. if (bStopNow || bStopAfterWin)
  43. {
  44. bStopNow = false;
  45. bStopAfterWin = false;
  46. return;
  47. }
  48. nextBet = parseFloat(initialBet);
  49. roll();
  50. });
  51. socket.on("losses", function (data) {
  52. if (bStopNow)
  53. {
  54. bStopNow = false;
  55. return;
  56. }
  57. nextBet = nextBet * martingaleMultiplier;
  58. roll();
  59. });
  60. socket.on("jderror", function (data) {
  61. roll();
  62. });
  63. }
  64. window.botInitialized = true;

comments powered by Disqus