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:
  #16  
Old March 11th, 2004, 01:48 AM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 12 m 16 sec
Reputation Power: 7
[Blackjack] RE: RE: Results


Quote:
This is the first time I entered in the competition, and I put in a great deal of time and effort to send in a script with an original approach, and acceptable results. It was a lot of fun to do, and I'd like to know how my script did compared to others.


Agreed...I too would like to run your script. The way you see it on FTP is how it came through in mail. I just double checked by pulling the attachment from the mail again just to be sure. I also check it in three different editors, and also simply paged it with more. The extra characters are there in every instance.

I tell you what, why don't you tar and gzip a good copy and send it to mattATcodewalkers.com. If you can get a good one through to me, I will happily run it against the entire data set.

Also, I do have notes about each disqualified script at my work. I apologize as I meant to post them already. I won't be back at work until Friday, but I will post the notes and rejudge your script at that time.


Reply With Quote
  #17  
Old March 11th, 2004, 02:38 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: Results

For those interested, I put a zipped version of my script here. I just put together my own 'judging' script and I would have gotten 1024237...good enough for 10th place.

Reply With Quote
  #18  
Old March 11th, 2004, 03:36 AM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 12 m 16 sec
Reputation Power: 7
[Blackjack] RE: Results

I have located the problem. It seems that it is a problem with my MTA. Well, it's not really a problem. The rfc dictates that lines coming through the MTA should not be longer than 900 chars. So, the MTA cuts them off. If the attachment had been encoded in some way, this wouldn't have been a problem.

Anyway, I now have a good script and will run the judging on it Friday.

Please continue to scrutinize the other scripts

Reply With Quote
  #19  
Old March 11th, 2004, 10:10 AM
Reggino Reggino is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Wijk aan Zee, The Netherlands
Posts: 16 Reggino User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Reggino
[Blackjack] RE: Results

Congrats Zulan!

Hmphzz... 16th place for me :-S i didn't expect it to be so bad... Well, maybe better luck next time... Thanx guys for the competition!

Reply With Quote
  #20  
Old March 11th, 2004, 03:33 PM
Zulan Zulan is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Germany
Posts: 31 Zulan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
[Blackjack] RE: RE: Results


Quote:
For those interested, I put a zipped version of my script here. I just put together my own 'judging' script and I would have gotten 1024237...good enough for 10th place.

My judge gave you 1019980 tested with a few other scripts producing the same scores.

Was there actually any script using more than 1s / game.. Have not spotted one yet.

Best Regards
Thomas Ilsche aka Zulan

Reply With Quote
  #21  
Old March 11th, 2004, 04:37 PM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 12 m 16 sec
Reputation Power: 7
[Blackjack] RE: Results

26 was using a fair bit of time...

Reply With Quote
  #22  
Old March 12th, 2004, 02:49 AM
BondGamer BondGamer is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 53 BondGamer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
[Blackjack] RE: Results

I am glad I just ended in the black, all my script was designed to do =]

Reply With Quote
  #23  
Old March 12th, 2004, 03:38 PM
zackcoburn zackcoburn is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 184 zackcoburn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
[Blackjack] RE: Results

I created a makeshift judging script.

I put all the entry folders (1 through 37, minus the disqualified entries... I realized after I forgot to run the latest version of number 27) in /var/www/html/contests/blackjack, along with blackjacklib.php and my own judge.php.

php Code:
Original - php Code
  1.  
  2. <?php
  3. //judge.php
  4. ini_set("PHP_INCLUDE_PATH","/var/www/html/contests/blackjack");
  5. $players=array("1","2","3","4","6","7","8","9","10","11","12","13","15","16","17","19","20","21","22","23","24","25","26","28","29","30","31","32","33","34","35","36","37");
  6.  
  7. function make_seed() {
  8.     list($usec, $sec) = explode(' ', microtime());
  9.     return (float) $sec + ((float) $usec * 100000);
  10. }
  11.  
  12. //-------------------------------------------------------//
  13.  
  14. for($z=1;$z<=1000;$z++){
  15.     $seed=make_seed();
  16.     mt_srand($seed);
  17.     srand($seed);
  18.     $decks=mt_rand(1,10);
  19.     $cards=array();
  20.     for ($n=0; $n<$decks; $n++) {
  21.         for ($card=1; $card<=13; $card++) {
  22.             $cards[]=$card;
  23.             $cards[]=$card;
  24.             $cards[]=$card;
  25.             $cards[]=$card;
  26.         }
  27.     }
  28.     for ($n=0; $n<10; $n++) {
  29.         shuffle($cards);
  30.     }
  31.     global $__gamestate;
  32.     $__gamestate=array(
  33.         "cards" => $cards,
  34.         "cansplit" => mt_rand(0,1)?true:false,
  35.         "candouble" => mt_rand(0,1)?true:false,
  36.         "cansurrender" => mt_rand(0,2)?false:true,
  37.         "willstandsoft17" => mt_rand(0,1)?false:true,
  38.         "maxbet" => mt_rand(1,10)*5,
  39.         "dealerhiddencard" => -1
  40.     );
  41.     $game="";
  42.     foreach($__gamestate as $key=>$value){
  43.         if ($key=="cards"){
  44.             foreach($value as $card){
  45.                 $game.="card=".$card."n";
  46.             }
  47.         }else{
  48.             $game.=$key."=".$value."n";
  49.         }
  50.     }
  51.     $gamefile="game.txt";
  52.     $gamefile = fopen($gamefile, 'w+');
  53.     fwrite($gamefile,$game);
  54.  
  55.     echo "-----------Game $z-----------n";
  56.     foreach($players as $value){
  57.         echo $value.": ";
  58.         $file="http://localhost/contests/blackjack/".$value."/blackjack.php";
  59.         $output=implode("",file($file));
  60.         preg_match("/Final amount: (.*)n/",$output,$match);
  61.         $output=$match[1];
  62.         echo $output."n";
  63.         $total[$value]+=($output-1000);
  64.     }
  65.     echo "n";
  66. }
  67. arsort($total);
  68. print_r($total);
  69. ?>


I modified blackjacklib.php's StartGame() function to grab the information from the latest random game.txt file. Judge.php simply loops through the players, and makes a new random game for each round, so that everybody plays the same games.
php Code:
Original - php Code
  1.  
  2. //blackjacklib.php
  3. function StartGame()
  4. {
  5.     $seed=time(); // if you want to play the same game over and over, set this to a fixed value
  6.     mt_srand($seed);
  7.     srand($seed); // shuffle uses rand(), AFAIK
  8.  
  9.     $decks=mt_rand(1,10);
  10.     $cards=array();
  11.     for ($n=0; $n<$decks; $n++) {
  12.         for ($card=1; $card<=13; $card++) {
  13.             $cards[]=$card;
  14.             $cards[]=$card;
  15.             $cards[]=$card;
  16.             $cards[]=$card;
  17.         }
  18.     }
  19.     for ($n=0; $n<10; $n++) { // so it gets shuffled better - shuffle() is quite weak
  20.         shuffle($cards);
  21.     }
  22.  
  23.     global $__gamestate;
  24.     $__gamestate=array(
  25.         "cards" => $cards,
  26.         "cansplit" => mt_rand(0,1)?true:false,
  27.         "candouble" => mt_rand(0,1)?true:false,
  28.         "cansurrender" => mt_rand(0,2)?false:true,
  29.         "willstandsoft17" => mt_rand(0,1)?false:true,
  30.         "maxbet" => mt_rand(1,10)*5,
  31.         "money" => 1000,
  32.         "state" => 0,
  33.         "dealercards" => array(),
  34.         "playercards" => array(),
  35.         "dealerhiddencard" => -1
  36.     );
  37.  
  38.     $game=implode("",file("/var/www/html/contests/blackjack/game.txt"));
  39.     $game=explode("n",$game);
  40.     $__gamestate["cards"]=array();
  41.     foreach($game as $line){
  42.         $line=explode("=",$line);
  43.         if ($line[0]=="card"){
  44.             array_push($__gamestate["cards"],$line[1]);
  45.         }elseif($line[0]<>""){
  46.             $__gamestate[$line[0]]=$line[1];
  47.         }
  48.     }
  49.  
  50.     $result=array(
  51.         "decks" => $decks,
  52.         "maximumbet" => $__gamestate["maxbet"],
  53.         "split" => $__gamestate["cansplit"],
  54.         "double" => $__gamestate["candouble"],
  55.         "surrender" => $__gamestate["cansurrender"],
  56.         "standsoft17" => $__gamestate["willstandsoft17"]
  57.     );
  58.  
  59.     return $result;
  60. }


I then ran judge.php for 1000 games (I started it last night, and it finished in the morning).

The final results are listed below. It should be noted that each script's total is the sum of its total return from each game (final amount-1000). In other words, if you played two games, and got $800 and $1201, your total would be $1.

Quote:
Array
(
[16] => 41813
[2] => 37730
[34] => 30671
[22] => 29883
[15] => 27640
[12] => 22784
[9] => 17091
[36] => 16360.3333333
[10] => 14196
[17] => 9768
[28] => 9649
[6] => 7726
[7] => 6495
[37] => 6350
[30] => 6164
[25] => 5926.25
[4] => 4716
[26] => 3449
[3] => 3346
[11] => 2449
[23] => -1402
[35] => -3637
[13] => -7013
[1] => -10344
[21] => -20094
[19] => -35737
[24] => -39271
[8] => -51540
[31] => -55645
[32] => -84102
[33] => -84916
[20] => -128807
[29] => -336342
)


This is interesting (note that this was made by hand... there could be a mistake):
Quote:
Script number | Place in my results | Place in the Codewalkers results
16 | 1 | 4
2 | 2 | 2
34 | 3 | 5
22 | 4 | 6
15 | 5 | 3
12 | 6 | 7
9 | 7 | 14
36 | 8 | 12
10 | 9 | 11
17 | 10 | 13
28 | 11 | 33
6 | 12 | 18
7 | 13 | 10
37 | 14 | 19
30 | 15 | 17
25 | 16 | 22
4 | 17 | 8
26 | 18 | 9
3 | 19 | 16
11 | 20 | 21
23 | 21 | 23
35 | 22 | 20
13 | 23 | 25
1 | 24 | 28
21 | 25 | 27
19 | 26 | 30
24 | 27 | 24
8 | 28 | 31
31 | 29 | 15
32 | 30 | 26
33 | 31 | 1
20 | 32 | 29
29 | 33 | 8


There are some very blatant contradictions when comparing my results to the Codewalkers results. I might have done something wrong in my judge script, so you should scrutinize that.

Reply With Quote
  #24  
Old March 13th, 2004, 05:39 PM
zackcoburn zackcoburn is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 184 zackcoburn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
[Blackjack] RE: Results

I ran my judge script again last night, and came up with these results:

Quote:
Array
(
[2] => 49904
[16] => 47999
[34] => 36556
[22] => 35838
[15] => 34376
[7] => 20039
[4] => 16287
[10] => 16247
[36] => 13170.3333333
[9] => 12768
[25] => 11647.5
[6] => 11174
[12] => 11148
[30] => 9532
[17] => 9450
[28] => 8313
[37] => 2557
[3] => 1351
[11] => 691
[26] => -978
[23] => -1703
[35] => -5021
[21] => -11384
[1] => -14962
[13] => -17014
[24] => -37115
[19] => -48423
[8] => -49937
[31] => -60617
[33] => -83969
[32] => -87409
[20] => -119353
[29] => -365522
)


Reply With Quote
  #25  
Old March 13th, 2004, 05:58 PM
Zulan Zulan is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Germany
Posts: 31 Zulan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
[Blackjack] RE: Results

That must have been a really slow machine.
My script is heavy time intensive and optimized for the judge system (2.4GHz Xeon machine).
Try this script: http://codewalkers.com/contests/spades/timer.txt
on your machine, it takes 5s on the judge.

My script also contains a "random factor" so when it would be ran on the judge machine again it might have different results.
It decides how detailled the calculations are done on the time left, and if the machine for whatever reason takes a millisecond longer that *might* lead to differnt results.

I'm also very keen on the judgeing script Matt used.

Best Regards
Thomas Ilsche

Reply With Quote
  #26  
Old March 13th, 2004, 06:40 PM
Zulan Zulan is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Germany
Posts: 31 Zulan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
[Blackjack] RE: Results

Well anyway your 2 results are sooo different so there must be a real problem. Most scripts should have the exactly same values if you run them twice!

Regards
Zulan

Reply With Quote
  #27  
Old March 13th, 2004, 08:19 PM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 12 m 16 sec
Reputation Power: 7
[Blackjack] RE: Results

All my notes, scripts, and everything is at work and things have been crazy the past couple of days. We will get all this worked out on Monday....

Reply With Quote
  #28  
Old March 14th, 2004, 12:14 AM
zackcoburn zackcoburn is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 184 zackcoburn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
[Blackjack] RE: Results

The second time I ran my judging script, I ran it with a different set of 1,000 games, since the games are always generated at run time by my judging script. My judging script does work in such a way, however, that every script plays the same 1,000 games (same with Matt's judging script). Really the point I'm trying to make is that the judging script needs to run a lot more than 1,000 games (or run every possible game ) in order to get accurate results and determine a true winner.

Reply With Quote
  #29  
Old March 14th, 2004, 12:45 AM
Zulan Zulan is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Germany
Posts: 31 Zulan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
[Blackjack] RE: RE: Results

Quote:
The second time I ran my judging script, I ran it with a different set of 1,000 games, since the games are always generated at run time by my judging script. My judging script does work in such a way, however, that every script plays the same 1,000 games (same with Matt's judging script). Really the point I'm trying to make is that the judging script needs to run a lot more than 1,000 games (or run every possible game ) in order to get accurate results and determine a true winner.


Well what computer your running that on, is it idle? Im interested in this because I find it highly doubtful that my script does generate negative results on that numbers with having decent resources.

Lets wait for Matts judging scripts.

Anyway if there was no real bug in the judge script I assume this results to be final, the judge even did 1000 games instead of the announced 160 ones seems a bit late to complain about that now.

[edit]
Maybe you got max_time not set to 60 but to 30. That would also change alot in the results towards the ones of matt.

Regards
Zulan

Reply With Quote
  #30  
Old March 14th, 2004, 03:21 AM
zackcoburn zackcoburn is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 184 zackcoburn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
[Blackjack] RE: Results

My judging script was running on an idle machine (Pentium 4 1.9GHz with 256MB RAM, running Red Hat Linux). I actually didn't even take the 60 second time limit into consideration... none of the scripts were taking nearly that long to run anyway.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP ContestsOlder Contests > [Blackjack] Results


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




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

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




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek