Bitcoin Forum
May 08, 2024, 08:22:46 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: BTCLotto, IRC-style!  (Read 958 times)
anthony_ (OP)
Member
**
Offline Offline

Activity: 65
Merit: 10


View Profile
June 16, 2011, 05:14:12 AM
Last edit: June 20, 2011, 04:37:47 AM by anthony_
 #1

Well, I threw a gambling part into my IRC bot, it works as follows:
You get a random number from 1-100 and where:
1-50 loses to the bank
51-89 wins 150% of the wager
90-99 wins 220% of the wager
100 wins the jackpot, you get 90% of it, the system gets 5% and 5% stays.

Every bid, jackpot gets 10% and system gets 5% of the wager.


Minimum bid is is 0.05, although in order to be eligible to win the jackpot, you have to wager 0.1 or more, otherwise if you roll 100 it will just do the standard 220%.


Anyways, if you wanted to give it a shot you can find him in #btcbot on irc.freenode.net.
It is host based, as long as your host doesn't change your balance will remain yours.
If you don't know how to use IRC, use this http://webchat.freenode.net/?channels=#btcbot

Code:
	case "roll":
if(!$args[2]) {
$bot->message($chan, $who[0] . ", use !btclotto roll <wager>");
return 0;
}
if(!is_numeric($args[2])) {
$bot->message($chan, $who[0] . ", number values only!");
return 0;
}
$wager = floatval($args[2]);
if($bitcoin->getbalance($who[2], 1) < $wager || $wager < 0.05) {
$bot->message($chan, $who[0] . ", you cannot wager that amount!!! it must be lower than your balance and at least 0.05");
return 0;
}
$num = rand(1,100);
$amount_won = 0.0;
$jackpot = false;
$winner = false;
$system_fee = $wager * 0.05;
if($num > 50 && $num < 90) {
$amount_won = $wager * 1.5;
$winner = true;
} elseif($num >= 90 && $num < 100) {
$amount_won = $wager * 2.2;
$winner = true;
} elseif($num == 100) {
if($wager > 0.1) {
$amount_won = $pot_balance * 0.90;
$system_fee = $system_fee + ($pot_balance * 0.05);
$jackpot = true;
} else {
$amount_won = $wager * 2.2;
$winner = true;
}
}
if($amount_won > $balance && $jackpot == false) {
$bot->message($chan, $who[0] . ", You rolled a " . $num . " and won more than the bank can pay out, bet lower or have bool_ transfer some spare funds.");
return 0;
}
if($winner) {
$bot->message($chan, $who[0] . ", You rolled a " . $num . " and won, " . $amount_won . " BTC has been sent to your balance.");
$bitcoin->move("bank", $who[2], $amount_won, 0);
} elseif($jackpot) {
$bot->message($chan, $who[0] . ", You rolled a 100 and won the jackpot, " . $amount_won . " BTC has been sent to your balance.");
$bitcoin->move("pot", $who[2], $amount_won, 0);
} else {
$bot->message($chan, $who[0] . ", You rolled a " . $num . " and lost, " . $wager . " BTC has been sent to the bank.");
}
$bitcoin->move($who[2], "bank", $wager, 0);
$jackpot_fee = $wager * 0.1;
$bitcoin->move("bank", "donations", $system_fee, 0);
$bitcoin->move("bank", "pot", $jackpot_fee, 0);
break;
Each block is stacked on top of the previous one. Adding another block to the top makes all lower blocks more difficult to remove: there is more "weight" above each block. A transaction in a block 6 blocks deep (6 confirmations) will be very difficult to remove.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715199766
Hero Member
*
Offline Offline

Posts: 1715199766

View Profile Personal Message (Offline)

Ignore
1715199766
Reply with quote  #2

1715199766
Report to moderator
1715199766
Hero Member
*
Offline Offline

Posts: 1715199766

View Profile Personal Message (Offline)

Ignore
1715199766
Reply with quote  #2

1715199766
Report to moderator
1715199766
Hero Member
*
Offline Offline

Posts: 1715199766

View Profile Personal Message (Offline)

Ignore
1715199766
Reply with quote  #2

1715199766
Report to moderator
anthony_ (OP)
Member
**
Offline Offline

Activity: 65
Merit: 10


View Profile
June 20, 2011, 04:36:48 AM
 #2

Oops, meant to edit code.
Bump anyways...
nhodges
Sr. Member
****
Offline Offline

Activity: 322
Merit: 251


View Profile
June 20, 2011, 04:40:02 AM
 #3

So, is this just for fun? How do we fund our rolls?

anthony_ (OP)
Member
**
Offline Offline

Activity: 65
Merit: 10


View Profile
June 20, 2011, 04:43:04 AM
 #4

So, is this just for fun? How do we fund our rolls?

There is a !btclotto newaddress and then you send money to the generated address (which is then linked to your hostname).
Once there is one confirmation it will show up in !btclotto balance, then you can do !btclotto roll <wager>.

Once you are done playing you can do !btclotto withdraw <sendtoaddress> [amount], amount being optional, if left blank it will send all of your money to you.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!