Click here to Skip to main content
15,885,936 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: Problem with Visual Cpp compiler Pin
Richard MacCutchan1-Dec-09 2:29
mveRichard MacCutchan1-Dec-09 2:29 
AnswerRe: Problem with Visual Cpp compiler Pin
LloydA11114-Jan-10 8:42
LloydA11114-Jan-10 8:42 
QuestionHelp with assigning variables to smarty template engine (php). Pin
djkee23-Nov-09 10:20
djkee23-Nov-09 10:20 
AnswerRe: Help with assigning variables to smarty template engine (php). Pin
fly90423-Nov-09 10:53
fly90423-Nov-09 10:53 
GeneralRe: Help with assigning variables to smarty template engine (php). Pin
djkee23-Nov-09 13:42
djkee23-Nov-09 13:42 
GeneralRe: Help with assigning variables to smarty template engine (php). Pin
fly90424-Nov-09 2:30
fly90424-Nov-09 2:30 
GeneralRe: Help with assigning variables to smarty template engine (php). Pin
djkee24-Nov-09 8:30
djkee24-Nov-09 8:30 
QuestionPERL Craps game Pin
Rhodge0923-Nov-09 9:30
Rhodge0923-Nov-09 9:30 
Well this is my code and i just want to modify it so that i can have buttons doing all the action. All that is coming up now is just text on the screen. How would i make like a button and two dice come up or just two numbers come up randomly telling me if i win or lose and if i do i gain money and if not i lose money. Also have a bank account keeping track of my money and when i hit $5 the game is over and if i hit $1000 dollars the game is over. Can anyone please help me i've asked all over and no ones been able to help me thanks.

This is the link:
!/usr/bin/perl
use CGI ':standard';
use CGI::Carp "fatalsToBrowser";

# How many games would you like to roll?
$iterations = 1000;

for ($count = $iterations; $count >= 1; $count--) {

print "$count \n";

# Bankroll per game. Rules are set up for a $5 bet on a 3x/4x/5x table.
$bankroll = 200;

$rollcount = 0;
$high = 200;

$itson = 1;

while ($itson == 1) {

$die1 = int(rand() * 6) + 1;
$die2 = int(rand() * 6) + 1;
$roll = $die1 + $die2;
$rollcount = $rollcount + 1;

if ($roll == 7 || $roll == 11) {
$bankroll = $bankroll + 5;
# print "W $roll $bankroll $rollcount\n";
if ($bankroll > $high) {
$high = $bankroll;
}
}

elsif ($roll == 2 || $roll == 3 || $roll == 12) {
$bankroll = $bankroll - 5;
# print "L $roll $bankroll $rollcount\n";
}

else {
$setnum = $roll;
$notcrapped = 1;
while ($notcrapped == 1) {

$die1 = int(rand() * 6) + 1;
$die2 = int(rand() * 6) + 1;
$roll = $die1 + $die2;
$rollcount = $rollcount + 1;

if ($roll == $setnum) {
$bankroll = $bankroll + 35;
# print "W $roll $bankroll $rollcount\n";
if ($bankroll > $high) {
$high = $bankroll;
}
$notcrapped = 0;
}

if ($roll == 7) {

if ($setnum == 4 || $setnum == 10) {
$bankroll = $bankroll - 20;
}

if ($setnum == 5 || $setnum == 9) {
$bankroll = $bankroll - 25;
}

if ($setnum == 6 || $setnum == 8) {
$bankroll = $bankroll - 30;
}

# print "L $roll $bankroll $rollcount\n";
$notcrapped = 0;
}
}
}

# Game ends when you have less than $5
if ($bankroll < 5) {
$losses = $losses + 1;
$itson = 0;
}

# It also ends if youmake $1000
if ($bankroll >= 1000) {
$wins = $wins + 1;
$itson = 0;
}

}

if ($high > $biggest) {
$biggest = $high;
}

if ($rollcount > $mostrolls) {
$mostrolls = $rollcount;
}

$bigrollcount = $bigrollcount + $rollcount;
$bighigh = $bighigh + $high;

}

print "$iterations Iterations \n";
print "Ave Rollcounts: " . sprintf("%.3f", $bigrollcount/$iterations) . "\n";
print "Ave Rollcounts Hours: " . sprintf("%.3f", int($bigrollcount/$iterations)/180) . "\n";
print "Most Rollcounts: $mostrolls\n";
# Most Rollcounts Days assumes 3 rolls/minute.
print "Most Rollcounts Days: " . sprintf("%.3f", ($mostrolls/180)/24) ."\n";
print "Ave Most Won: " . ($bighigh/$iterations) . "\n";
print "Biggest Win: $biggest\n";
print "$wins Wins | $losses Losses";

AnswerRe: PERL Craps game Pin
Rhodge0923-Nov-09 9:51
Rhodge0923-Nov-09 9:51 
Questionextract numeric values from string Pin
shaina223120-Nov-09 2:42
shaina223120-Nov-09 2:42 
AnswerRe: extract numeric values from string Pin
cjoki20-Nov-09 6:37
cjoki20-Nov-09 6:37 
AnswerRe: extract numeric values from string Pin
fly90420-Nov-09 17:14
fly90420-Nov-09 17:14 
AnswerRe: extract numeric values from string Pin
Marc Firth23-Nov-09 22:21
Marc Firth23-Nov-09 22:21 
GeneralRe: extract numeric values from string Pin
fly90424-Nov-09 2:32
fly90424-Nov-09 2:32 
GeneralRe: extract numeric values from string Pin
Marc Firth24-Nov-09 2:45
Marc Firth24-Nov-09 2:45 
QuestionWeb framework [modified] Pin
rastaVnuce18-Nov-09 14:39
rastaVnuce18-Nov-09 14:39 
AnswerRe: Web framework Pin
Michael Hansen23-Nov-09 12:37
Michael Hansen23-Nov-09 12:37 
GeneralRe: Web framework Pin
rastaVnuce23-Nov-09 12:40
rastaVnuce23-Nov-09 12:40 
AnswerRe: Web framework Pin
Chris Austin5-Dec-09 8:24
Chris Austin5-Dec-09 8:24 
GeneralRe: Web framework Pin
rastaVnuce8-Dec-09 13:52
rastaVnuce8-Dec-09 13:52 
GeneralRe: Web framework Pin
Massimo Di Pierro25-Dec-09 11:17
Massimo Di Pierro25-Dec-09 11:17 
Questionhow can i view crystal report on an apche server, not IIS on windows server 2003 ? Pin
amran imu17-Nov-09 15:41
amran imu17-Nov-09 15:41 
QuestionMovement for Isometric Game Pin
Isoprog16-Nov-09 19:03
sussIsoprog16-Nov-09 19:03 
AnswerRe: Movement for Isometric Game Pin
Asday30-Nov-09 1:26
Asday30-Nov-09 1:26 
Questionblob file (.jpg) has been inserted into database but no value, please help.... Pin
alexyxj16-Nov-09 12:04
alexyxj16-Nov-09 12:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.