Jump to content

Lukeidiot

Members
  • Posts

    187
  • Joined

  • Last visited

About Lukeidiot

  • Birthday 01/01/1989

Contact Methods

  • Website URL
    http://SnapChatWeb.com

Profile Information

  • Gender
    Male
  • Location
    New York

Lukeidiot's Achievements

Regular Member

Regular Member (3/5)

8

Reputation

1

Community Answers

  1. Here is what I managed to come up with: function calculateRollLowProfit(game_int, bet, house_edge){ var roll = game_int - 1; var game_int = 100 - game_int; var chance = (100 - game_int); var multiplier = (house_edge / chance); payout = bet * multiplier - bet; payout = toFixed(payout, 5); payout = parseFloat(payout); $('.low .profit2').text(payout); } function calculateRollHighProfit(game_int, bet, house_edge){ var roll = game_int - 1; var chance = (99 - game_int); var multiplier = (house_edge / chance); payout = bet * multiplier - bet; payout = toFixed(payout, 5); payout = parseFloat(payout); $('.high .profit2').text(payout); }Preview: <site>
  2. I am trying to make this complicated JavaScript into a more simple, workable approach. Here is a link to the full source code: http://paste.ubuntu.com/16651803/ I am trying to accomplish the following stats: End Goal: Calculate Profit for Roll High and Roll Low Here is the function I believe is responsible for calculating: namespace("Rollin.Casino.Dice.Stats", function() { var t, e; return t = namespace.use("Rollin.Casino.Dice.Dice"), e = function() { function e(t, e) { this.number = t, this.dice = e } return e.prototype.decimal = 5, e.prototype.getData = function(e, n, r) { var i, o, s, a, u; switch (r > t.MAX_NUMBER - 1 && (r = t.MAX_NUMBER - 1), r < t.MIN_NUMBER + 1 && (r = t.MIN_NUMBER + 1), i = this.dice.getFee(), n) { case t.PREDICTION_BIGGER: o = (100 - i) / (t.MAX_NUMBER - r), s = t.MAX_NUMBER - r; break; default: o = (100 - i) / r, s = r } return a = e * o, u = a - e, a > 99999 && (a = 99999), u > 99999 && (u = 99999), a = this.number.floorDecimal(a, this.decimal), u = this.number.floorDecimal(u, this.decimal), this.number.isNaN(a) && (a = 0), this.number.isNaN(u) && (u = 0), { multiplier: o, odds: s, payout: a, profit: u } }, e }() }), Here is the same function being used: t.prototype.changeStats_ = function() { var t, n, r, i; return t = this.dice.betAmount, i = this.dice.betNumber, n = this.stats.getData(t, e.PREDICTION_BIGGER, i), r = this.stats.getData(t, e.PREDICTION_SMALLER, i), this.element.find(".stats.high .profit").text(n.profit), this.element.find(".stats.high .odds").text(n.odds + "%"), this.element.find(".stats.low .profit").text(r.profit), this.element.find(".stats.low .odds").text(r.odds + "%") } So, how can I make a simple function where I can calculate the profit by using something such as this: calculateRollHighProfile(betsize, predictionNumber, houseEdge); Live example: https://rollin.io Please note: Profits are affected by house edges below:
  3. I think our numbers are different because there are "levels" based on how much you have wagered. For instance I am level 3, and my house edge is only 0.96%. I believe level 1 (your level) house edge is 0.99%.
  4. Yes, my head hurts after using lots of math, but here lies to key: namespace("Rollin.Casino.Dice.Stats", function() { var t, e; return t = namespace.use("Rollin.Casino.Dice.Dice"), e = function() { function e(t, e) { this.number = t, this.dice = e } return e.prototype.decimal = 5, e.prototype.getData = function(e, n, r) { var i, o, s, a, u; switch (r > t.MAX_NUMBER - 1 && (r = t.MAX_NUMBER - 1), r < t.MIN_NUMBER + 1 && (r = t.MIN_NUMBER + 1), i = this.dice.getFee(),n) { case t.PREDICTION_BIGGER: o = (100 - i) / (t.MAX_NUMBER - r), s = t.MAX_NUMBER - r; break; default: o = (100 - i) / r, s = r } return a = e * o, u = a - e, a > 99999 && (a = 99999), u > 99999 && (u = 99999), a = this.number.floorDecimal(a, this.decimal), u= this.number.floorDecimal(u, this.decimal), this.number.isNaN(a) && (a = 0), this.number.isNaN(u) && (u = 0), { multiplier: o, odds: s, payout: a, profit: u } }, e }() }), Full code: http://paste.ubuntu.com/16651803/ I just can't seem to quite figure out the correct formula
  5. Hello Math Gods of phpfreaks. I am in need of a .... formula.... Let's inspect the outcomes.. As we can see, we have the BET SIZE (5), PREDICTION (88) which gives us our profits 40.01818 and 0.62727 So my question is: how do we get the Roll High Profits(40.01818), and Roll Low Profits(0.62727) from BET SIZE and PREDICTION? Anyone got a php function/formula for this? Or just a general math formula? (for a live example visit: https://rollin.io)
  6. I dont think this is working correctly. Im willing to paypal you some money if you could help a bit more. Skype: Lukecode
  7. Can you explain how I would use this in a while loop a bit? I added WHERE u.username = '$username' as well. for example: $row['m.message']; ?
  8. Here my code that will display all chat message groups and messages ORDERED BY when the group was created. I am trying to instead order the message_group list by last message received instead (exactly how imessage or any text message works) <?php $sql_messages = mysqli_query($connect, "SELECT DISTINCT group_id FROM message_group WHERE username = '$username' || recipients = '$username' ORDER BY id DESC;"); $num_messages = mysqli_num_rows($sql_messages); if($num_messages == 0){ ?> <div id="messagegroups"> <div align="center" style="padding: 5px;" id="nomsg">You have no messages at this time.</div> <div id="messagegroupholder"> </div> <?php } else { ?> <div id="messagegroups"> <?php while($row_messages = mysqli_fetch_assoc($sql_messages)){ ?> <?php $snm = mysqli_query($connect, "SELECT * FROM message_group WHERE group_id = '$row_messages[group_id]' ORDER BY id DESC"); $rm = mysqli_fetch_assoc($snm); $nm = mysqli_num_rows($snm); $ur = mysqli_query($connect, "SELECT * FROM users WHERE username = '$rm[recipients]' ORDER BY id DESC;"); $rr = mysqli_fetch_assoc($ur); $um = mysqli_query($connect, "SELECT * FROM messages WHERE group_id = '$row_messages[group_id]' ORDER BY id DESC;"); $rrr = mysqli_fetch_assoc($um); ?> <div id="messagegroupholder"> <div class="qo cj ca js-msgGroup groupclick" id="msg" data-id="<?php echo $rm['group_id']; ?>"> <a class="b"> <div class="qf"> <span class="qj"> <img class="cu qh" src="./img/<?php echo $rr['image']; ?>" style="height: 42px; width: 42px;"> </span> <div class="qg"> <strong><?php echo $rr['username']; ?></strong> and <strong><?php echo $nm - 1 ?> others</strong> <div class="aof"> <?php echo substr($rrr['message'], 0, 60); ?> … </div> </div> </div> </a> </div> </div> <?php } ?> <?php } ?> </div> MySQL Structure: -- -------------------------------------------------------- -- -- Table structure for table `messages` -- CREATE TABLE IF NOT EXISTS `messages` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(100) NOT NULL, `message` text NOT NULL, `ipaddress` varchar(100) NOT NULL, `timestamp` int(11) NOT NULL, `group_id` varchar(20) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=318 ; -- -------------------------------------------------------- -- -- Table structure for table `message_group` -- CREATE TABLE IF NOT EXISTS `message_group` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(100) NOT NULL, `recipients` varchar(255) NOT NULL, `group_id` varchar(20) NOT NULL, `ipaddress` varchar(100) NOT NULL, `timestamp` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=82 ; -- -- Table structure for table `users` -- CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, `password` varchar(50) NOT NULL, `user_level` int(11) NOT NULL DEFAULT '0', `name` varchar(100) NOT NULL, `image` varchar(100) NOT NULL DEFAULT 'default.png', `profile_background` varchar(255) NOT NULL DEFAULT 'default_background.png', `description` varchar(255) NOT NULL, `went_to_school` varchar(100) NOT NULL, `worked_at` varchar(100) NOT NULL, `lives_in` varchar(100) NOT NULL, `from_originally` varchar(100) NOT NULL, `expires` datetime NOT NULL, `ipaddress` varchar(50) NOT NULL, `browser` varchar(100) NOT NULL DEFAULT 'n/a', `show_email` int(11) NOT NULL DEFAULT '1', `timestamp` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=32 ; Preview of how the data is stored: http://imgur.com/fdG2n0g Recap: So how can I instead order the message_groups by when the last message was received instead of when the last group was created?
  9. <?php $sql_messages = mysqli_query($connect, "SELECT DISTINCT group_id FROM message_group WHERE username = '$username' || recipients = '$username' ORDER BY id DESC;"); $num_messages = mysqli_num_rows($sql_messages); if($num_messages == 0){ ?> <div id="messagegroups"> <div align="center" style="padding: 5px;" id="nomsg">You have no messages at this time.</div> <div id="messagegroupholder"> </div> <?php } else { ?> <div id="messagegroups"> <?php while($row_messages = mysqli_fetch_assoc($sql_messages)){ ?> <?php $snm = mysqli_query($connect, "SELECT * FROM message_group WHERE group_id = '$row_messages[group_id]' ORDER BY id DESC"); $rm = mysqli_fetch_assoc($snm); $nm = mysqli_num_rows($snm); $ur = mysqli_query($connect, "SELECT * FROM users WHERE username = '$rm[recipients]' ORDER BY id DESC;"); $rr = mysqli_fetch_assoc($ur); $um = mysqli_query($connect, "SELECT * FROM messages WHERE group_id = '$row_messages[group_id]' ORDER BY id DESC;"); $rrr = mysqli_fetch_assoc($um); ?> <div id="messagegroupholder"> <div class="qo cj ca js-msgGroup groupclick" id="msg" data-id="<?php echo $rm['group_id']; ?>"> <a class="b"> <div class="qf"> <span class="qj"> <img class="cu qh" src="./img/<?php echo $rr['image']; ?>" style="height: 42px; width: 42px;"> </span> <div class="qg"> <strong><?php echo $rr['username']; ?></strong> and <strong><?php echo $nm - 1 ?> others</strong> <div class="aof"> <?php echo substr($rrr['message'], 0, 60); ?> … </div> </div> </div> </a> </div> </div> <?php } ?> <?php } ?>
  10. I know that, but I have a sql query inside of another sql query, so how do I order by the 2nd query?
  11. Hey there, I am trying to order my messages by last message received instead of last message created. (Live Site if you want to try a live preview: https://snaps.im) send a message to: admin Here is how it is currently: Here is my mysql table: I basically need it to order exactly how imessages are stored on an iphone or phone.
  12. Actually, here's what I came up with (didnt include the quotes tho, didnt really understand a good way to do it.) <p>Quote of the day: <i>Don't watch the clock; do what it does. Keep going.</i></p> <?php $rowdates = mysqli_query($connect, "SELECT DISTINCT datestamp FROM links ORDER BY datestamp DESC"); $dates = array(); while($row = mysqli_fetch_assoc($rowdates)) { $dates[] = $row; } ?> <?php foreach($dates as $value) { ?> <h1><?php echo date('M d Y', strtotime($value['datestamp'])); ?></h1> <strong>Today's Links</strong> <ul> <?php foreach($value as $key => $val) { $sql_links = mysqli_query($connect, "SELECT * FROM links WHERE datestamp = '$val' ORDER BY timestamp DESC, CHAR_LENGTH(description)"); while($row_links = mysqli_fetch_array($sql_links)){ ?> <li><a href="<?php echo $row_links['url']; ?>"><?php echo $row_links['description']; ?></a></li> <?php } } ?> </ul> <hr style="border: 1px dashed grey;"> <?php } ?>
  13. Can you give me an example line of code for this? "you would then run a query that selects the data you want in the order that you want it. you would probably want a secondary sort order on the description so that the links are in alphabetical order within any date. you would fetch the data into a multi-dimensional array, using the date as the main array key/index. this will give you a sub-array of data for each date." Because I am confused if I need a foreach inside the while loop?
  14. $1000 for lifetime script access to a chatroom? Are you insane? lol
  15. Hello fine phpfreak members. I am having a brain cloud and cannot remember how to get these results out correctly. Here is my mysql table: And I need the data to show up like such: NOTE: I have a table called "quotes" with
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.