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:
  #1  
Old February 29th, 2004, 11:31 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
[Blackjack] Good luck!

Good luck everyone!

You can check GMT time at http://g-m-t.com/index.htm. There are about 15 minutes left right now!

Once the deadline passes, share your strategy with everyone in this thread!

Reply With Quote
  #2  
Old March 1st, 2004, 01:07 AM
danharan danharan is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Halifax, NS, Canada
Posts: 2 danharan 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 danharan
[Blackjack] RE: Good luck!

Well, this was my first competition, and it was quite a lot of fun figuring out a strategy for this- even though mine might actually not do better than miniplay...

I only heard about this a few days ago, and after a refresher in card counting theory, and re-reading the rules, I realize any systems out there would be pretty useless.

I did however use the effects of removal to determine betting strategy, because I did not have time to simulate these 16 (er, 160) different games to come up with appropriate tables. I also used basic strategy splitting tables, although it would have been possible to integrate it into my algorithm.

My version keeps track of the number of each card number left in the shoe. This can let you determine the dealer's probability of busting or getting any hand. By applying the same logic to the player's hand, it is possible to determine the player's expectation. Naturally, with more time it should have been possible to recurse this while accounting for the effects of card removal.

What I wanted to get was the expected value for each play: how much money is lost by hitting vs. standing or doubling, etc... The EV was defined as the %win - %loss, naturally ignoring the % of ties; an idea I took from the Theory of Blackjack by Griffin.

One "d'oh!": after sending my submission I realized that the surrender function -which I added at the last minute- was probably not using the right numbers... If hitting and standing are both losing hands, with a negative EV, it probably makes sense to surrender when possible. Doubling when $ev_hit>($ev_stand*2). I did not have time to code the case of splitting

I'll keep an eye out for future contests so as to not be so rushed...

Good luck to everyone!

Reply With Quote
  #3  
Old March 1st, 2004, 05:01 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
[Blackjack] RE: Good luck!

I submutted my code just before it ended and havent got any confirmation till now... do I need to fear somethings messed up?

Reply With Quote
  #4  
Old March 1st, 2004, 03:01 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
[Blackjack] RE: Good luck!

aw still no reply yet... I hope my submission made it allright to compete...

Reply With Quote
  #5  
Old March 1st, 2004, 03:06 PM
tkarkkainen's Avatar
tkarkkainen tkarkkainen is offline
Moderator
Click here for more information
 
Join Date: Apr 2007
Location: Finland
Posts: 2,331 tkarkkainen User rank is Lance Corporal (50 - 100 Reputation Level)tkarkkainen User rank is Lance Corporal (50 - 100 Reputation Level)tkarkkainen User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 26229 Folding Title: Starter FolderFolding Points: 26229 Folding Title: Starter Folder
Time spent in forums: 6 Days 15 h 33 m 41 sec
Reputation Power: 5
[Blackjack] RE: Good luck!

I think the replies are written and sent manually so you shouldn't have to worry so much if it takes some time

Reply With Quote
  #6  
Old March 1st, 2004, 03:45 PM
Wiggy Wiggy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Manchester, United Kingdom
Posts: 14 Wiggy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[Blackjack] RE: Good luck!

This was my first ever codewalkers php contest. In fact, this is the first php contest I've ever done. It was fun, but next time I need to plan my time better and perhaps think through what is possible more clearly before I start to write code. As I wasn't being paid for this, I didn't take a detailed systems analysis approach, which is probably why I took the route I did.

Quote:
Once the deadline passes, share your strategy with everyone in this thread!


Well, in the comments at the top of my code I included my strategy so it would be explained to all who looked on the FTP site after the comp is done and dusted. I repeat those comments here:

Quote:
Firstly, Blackjack is one of the cheapest games to play in a casino. It's only marginally more expenisve to play than the even-money bets at the roulette table. There are situations where you can actually get a cheaper/better set of odds where the count is in your favour. There is alo a preferred method of playing called Basic Strategy for making sure your bets are the right ones.

The thing about card counting and basic strategy is that they are tools that approximate correct play. No player in a loud noisy casino can tell you towards the end of a 10-deck show how many queens of hearts have gone by. They can't calculate the PRECISE probability of getting a blackjack on this hand or on the hand three hands from now. The tools they use are simplified to take into account human vulnerabilities. They are to gambling what lego is to the building industry.

So, you should just write a script that can handle that right? Work out all the right odds and bet accordingly? Yes. Except that isn't what I did. I'm a romantic gambler at heart and so decided to just implement a basic strategy. And my staking? Maximum bet every time. Brutal, inelegant, but it's what I would play myself in a casino, so that's what I send my script out to do. I don't expect to win, as I can't tell my script to walk away when it's ahead.

This might seem daft, but if the strong hands are in the early part of the generated decks, I actually have an edge over the probability boys. So, it's about 1/3 I will not finish "in the money" on this one, but at least I tried. And if you ever needed a script that can play basic strategy, here it is.


... then the code begins. I basically used a basic single-deck strategy which is the only one I could remember, and whilst wizardofodds.com had great tables for multiple deck and different rules, I didn't have time to implement them. Especially as I had already concluded I was writing this the wrong way, I didn't care. The right way was to do the hard maths. The way I figured it, I wanted my script to play the way I would, and it's so long since I last played Blackjack for money, that's the way I would play it.

If work hadn't been so hectic, what I would have done instead is to keep a VERY detailed count of the cards going by - not just adding one for high, deducting one for low, but counting how many tens, how many jacks, etc... I'd then towards the end of a shoe be able to accurately predict my chances of making a blackjack and be able to stake, double, hit and stand accordingly. As it is, what I did is what I did.

Good luck to all, and if I do finish in the money (i.e. eligible for prizes) below you, whatever you do, don't leave me with a domain name for a month or a t-shirt. :-)

Reply With Quote
  #7  
Old March 1st, 2004, 09:37 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: Good luck!

My approach was quite independant from any knowledge of other persons. I read though a paper about russian black jack by Vladimir Mazalov. Sadly I didnt understand alot of but but by coding my own recursive algorithm for total enumeration it showed up beeing quite similar to the approach of Mazalov using optimal stopping theory / Belman equation / recursion backwards method.

There are 2 main problems with that. On low points, especially with aces considered as 1 it is not feasable to compute in the given timeframe. So I had to limit the recursion etc..
The other main problem is that each hand is played independant - I have not considered using lots of cards will decrease winning probability on other following hands. I would have done that but time was not my friend last week
Aswell I am allways going for MaxBet. But I actually see no situation where, at bet time, your chance to win is lower than 1. But there gotta be some sitations I bet.


Had no time to read and understand your soltions right now... Good luck all of you!

Best Regards

Zulan

Reply With Quote
  #8  
Old March 2nd, 2004, 04:05 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: Good luck!

I took the bayesian approach. I made a training script that counted the number of times, and under which circumstances, a certain result was achieved. After a LOT of training games, the script will be able to calculate the expected value for each possible play, for given circumstances. Of course, the EV for a surrender is always -.5. I also let my script calculate an EV before i made a bet(based on the card count). There was a slight correlation between this EV and the final result of the hand, (I plotted the results against the EV)so I decided to bet in three categories based on the EV:
EV<-.2 : bet 2 (there's always a chance for blackjack, so always bet even)
EV>-.2 & EV<-.03 : bet half the maximum, rounded upwards to the next multiple of two
EV>-.03 : bet the maximum.
The numbers are based on the line of best fit.

Fun facts:
my final script only contained about 200 lines of code
the line containing the bayesian array is about 120 KB (defines array)
the average gain of the script lies somewhere between 17 and 18
the final script uses an array that is build from 100000 random training decks.
this training took about a day.

Basically, the script taught itself to play blackjack. It was a lot of fun and quite educational to code this. I'm highly curious about the results and other people's code.

Reply With Quote
  #9  
Old March 2nd, 2004, 04:11 AM
Nicky's Avatar
Nicky Nicky is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Neverland
Posts: 606 Nicky User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 6 m 53 sec
Reputation Power: 3
[Blackjack] RE: Good luck!

I don't like losing so I didn't enter....

But good luck to all who did. I'm interested to see who had the best strategy.

Reply With Quote
  #10  
Old March 2nd, 2004, 01:14 PM
Wiggy Wiggy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Manchester, United Kingdom
Posts: 14 Wiggy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[Blackjack] RE: RE: Good luck!

Quote:
Fun facts:
my final script only contained about 200 lines of code
the line containing the bayesian array is about 120 KB (defines array)


If there was a prize for the most insane entry, I think you get it. I had never even thought about taking a Bayesian approach, but thinking about it, it does appeal to me simply because it means your script has an element of fuzzy memory about it. I suspect you could have improved it by "teaching" it to count cards as well to understand it's probability of winning and also to adjust betting - i.e. when lots of high cards in the deck bet big, and when there are lots of low cards, keep it short.

Interesting though. Good luck.

Reply With Quote
  #11  
Old March 2nd, 2004, 01:35 PM
deception54 deception54 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 deception54 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[Blackjack] RE: Good luck!

It was my first time in a contest. I think I totally messed it up, because I calculated probabilities on each hand. I think I should have played my first hands using if-else rules, then calculate the probabilities when there is less than 100 cards left in the deck.

My code usually beats the dealer, but 10 decks take 939 seconds to compute on a Pentium3/650MHz, so I am gonna have huge penalties.


...hope to win a t-shirt!

Reply With Quote
  #12  
Old March 2nd, 2004, 03:18 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: Good luck!

Mine is bout 650 loc.. but half of it is repeating functions with different names and slightly different behavior. Due to high frequency calls I prefered that towards using one, but more dynamic function.

I thought about the training thingy aswell but there are just to many situtaions in the game to get a "complete" record.

Regards
Zulan

Reply With Quote
  #13  
Old March 5th, 2004, 03:26 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: 3
Send a message via AIM to Jeff321
[Blackjack] RE: Good luck!

My script probably sucks lol, but that's ok, it's only my first contest
Good luck to all who entered!

Reply With Quote
  #14  
Old March 5th, 2004, 03:09 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: Good luck!


Quote:
My script probably sucks lol, but that's ok, it's only my first contest
Good luck to all who entered!


So does mine... Im also here for the first time.

Dont feel ashamed post some details of your script cmon

bahhh.. I can't wait until Judging is over

Reply With Quote
  #15  
Old March 5th, 2004, 04:55 PM
Basseq Basseq is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Richmond
Posts: 5 Basseq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Basseq
[Blackjack] RE: Good luck!

I didn't enter either. I was going to, but I never figured out the PlaySplit() and some other functions. My logic was pretty simple... stay on hard 17, stay on soft 19. I had a neat way of determining and incrementing money that made it possible to lose three or four hands in a row, and then win and still post a profit. I had some logic errors somewhere, and I just didn't have time to work them all out. Oh well, maybe next time.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP ContestsOlder Contests > [Blackjack] Good luck!


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 4 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek