SunQuest
           Older Contests
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP ContestsOlder Contests

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old February 2nd, 2004, 09:57 PM
wtfai wtfai is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Rochdale, UK
Posts: 14 wtfai User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[Blackjack] How many games?

How many games will there be in the judging? I ask because I'm finding that I'm needing a lot of games to get a reasonably accurate measure of whether a change is an improvement or not, i.e. 100+. If a lot of people are getting near the 60s per game mark then judging could take a very long time. Admittedly I seem to be averaging about 0.1s per game so it may not be a problem.

Ben Hague

Reply With Quote
  #2  
Old February 3rd, 2004, 06:38 AM
xs0 xs0 is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Ljubljana, Slovenia
Posts: 760 xs0 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
[Blackjack] RE: How many games?

Most probably it will be 160 games - each combination of rules possible (except maxbet). If the scripts are mostly very slow, though, it will be less. Can't waste too much server time ;)

Reply With Quote
  #3  
Old February 4th, 2004, 07:31 AM
SizL SizL is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Amsterdam, NL, Europe
Posts: 12 SizL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[Blackjack] RE: How many games?

In that case, I might just as well send in miniplay.php (with my own bestval function, of course). In just 160 games, it has as good a chance as a 'more intelligent' script, because results WILL vary depending on the composition of the deck. My script averages a positive result, but in a random game, it may lose 700 bucks. If the assignment were to program a script that produced the best result for a given deck, scoring them like you said would be acceptable. IMHO the assignment is to program a script that will have the best advantage on the house. You'd need to score at least 1000 decks (random rules) to assess this. I understand that a maximum execution time of 60 secs does not allow this, but scoring less decks has too big a chance for a single strategy to luck out.

Reply With Quote
  #4  
Old February 4th, 2004, 07:46 AM
xs0 xs0 is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Ljubljana, Slovenia
Posts: 760 xs0 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
[Blackjack] RE: How many games?

Well, I don't think miniplay.php will do as well as possible.. We'll see

Reply With Quote
  #5  
Old February 4th, 2004, 08:37 AM
SizL SizL is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Amsterdam, NL, Europe
Posts: 12 SizL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[Blackjack] RE: How many games?

Just to be sure...i'd have to change GameStart() to StartGame, right?

Reply With Quote
  #6  
Old February 4th, 2004, 08:18 PM
xs0 xs0 is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Ljubljana, Slovenia
Posts: 760 xs0 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
[Blackjack] RE: How many games?

What the rules say
(StartGame)

Reply With Quote
  #7  
Old February 6th, 2004, 03:39 AM
Jeff321 Jeff321 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Near Chicago, IL, USA
Posts: 45 Jeff321 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Jeff321
[Blackjack] RE: How many games?

Ok, this is somewhat on topic... I was wondering if there's an easy way to have the script play multiple games at once. Right now when it's done it does exit() which kills everything. Is there some way to have it keep going or restart without making major changes to the library? Thanks.

Edit: Never mind, I think I can figure it out. Replacing exit() with a function that restarts the game.

Reply With Quote
  #8  
Old February 6th, 2004, 09:11 AM
SizL SizL is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Amsterdam, NL, Europe
Posts: 12 SizL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[Blackjack] RE: How many games?

Here's what I did: I made the lib into a class named blackjack. Instead of calling exit, I created a function named GameExit that records the final gamestate into a class variable named __finalstate. It also sets the boolean class variable GameEnd.

now I can run 10.000 games like this:

php Code:
Original - php Code
  1.  
  2. for($i=1;$i<=10000;$i++){
  3.    $bj=new blackjack;
  4.    while(!$bj->GameEnd){
  5.       $rules=$bj->gamestart();
  6.       $result=$bj->MakeBet(somefunction($rules));
  7.       while($result['status']=="YOURTURN" && !$bj->GameEnd){
  8.          //game logic
  9.       }
  10.    }
  11.    $winnings[]=$bj->__finalstate['money']-1000;
  12. }
  13. echo max($winnings)."n";
  14. echo min($winnings)."n";
  15. echo array_sum($winnings)/10000 ."n";


Don't forget to put '$this->' before all variable names in the original script.

Of course, my script is a lot more complex, and I could let you in on all the details, but then I'd have to kill you. ;)

Reply With Quote
  #9  
Old February 6th, 2004, 09:50 PM
Jeff321 Jeff321 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Near Chicago, IL, USA
Posts: 45 Jeff321 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Jeff321
[Blackjack] RE: How many games?

Haha. I actually did figure it out last night. Didn't make a class like you did, but the idea is similar in terms of the for() loop and function call instead of exit(). Thanks anyway and good luck in the contest!

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP ContestsOlder Contests > [Blackjack] How many games?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway