How To Write A Blackjack Program In C
Born | August 14, 1932 (age 88) Chicago, Illinois, U.S. |
---|---|
Citizenship | American |
Alma mater | UCLA |
Scientific career | |
Fields | Probability theory, Linear operators |
Institutions | UC Irvine, New Mexico State University, MIT |
Thesis | Compact Linear Operators in Normed Spaces(1958) |
Doctoral advisor | Angus E. Taylor |
Influences | Claude Shannon |
BlackJack 12:30:30 AM. So as a learning experience, I decided to try writing a Blackjack game. Puzzle Control 12:27:40 AM. In this application I had combined the power of C# and AI in order to solve the 'puzzle problem'. Maze Solver 12:15:44 AM. Blackjack MATLAB Snapshot of Code Running My Project Snapshot of Code Final Analysis Almost the reverse of actual casino games, the odds are mostly in the player's favor. The code does indeed accomplish a simple, fairly easy game of Blackjack which is also quite fun.
- Write a function that takes the values of a two-card blackjack hand as input, and prints out the point total of the hand. The value of the cards '2' through '9' is equal to their face value, the cards 'T', 'K', 'Q', 'J' are worth 10 points and the ace ('A') is worth 11 points unless it comes with another ace, then it's worth 1 point. The program should be able to catch incorrect input.
- To start the game of Blackjack, players are dealt two cards at random from a shuffled deck. You write the following code to simulate the act of dealing an initial hand. To test the code, you deal a hand 1 0 6 10^6 1 0 6 times and record the number of times the player.
Edward Oakley Thorp (born August 14, 1932) is an American mathematics professor, author, hedge fund manager, and blackjack researcher. He pioneered the modern applications of probability theory, including the harnessing of very small correlations for reliable financial gain.
Thorp is the author of Beat the Dealer, which mathematically proved that the house advantage in blackjack could be overcome by card counting.[1] He also developed and applied effective hedge fund techniques in the financial markets, and collaborated with Claude Shannon in creating the first wearable computer.[2]
Thorp received his Ph.D. in mathematics from the University of California, Los Angeles in 1958, and worked at the Massachusetts Institute of Technology (MIT) from 1959 to 1961. He was a professor of mathematics from 1961 to 1965 at New Mexico State University, and then joined the University of California, Irvine where he was a professor of mathematics from 1965 to 1977 and a professor of mathematics and finance from 1977 to 1982.[3]
Computer-aided research in blackjack[edit]
Thorp used the IBM 704 as a research tool in order to investigate the probabilities of winning while developing his blackjack game theory, which was based on the Kelly criterion, which he learned about from the 1956 paper by Kelly.[4][5][6][7] He learned Fortran in order to program the equations needed for his theoretical research model on the probabilities of winning at blackjack. Thorp analyzed the game of blackjack to a great extent this way, while devising card-counting schemes with the aid of the IBM 704 in order to improve his odds,[8] especially near the end of a card deck that is not being reshuffled after every deal.
Applied research in Reno, Lake Tahoe and Las Vegas[edit]
Thorp decided to test his theory in practice in Reno, Lake Tahoe, and Las Vegas.[6][8][9]Thorp started his applied research using $10,000, with Manny Kimmel, a wealthy professional gambler and former bookmaker,[10] providing the venture capital. First they visited Reno and Lake Tahoe establishments where they tested Thorp's theory at the local blackjack tables.[9] The experimental results proved successful and his theory was verified since he won $11,000 in a single weekend.[6] Casinos now shuffle well before the end of the deck as a countermeasure to his methods. During his Las Vegas casino visits Thorp frequently used disguises such as wraparound glasses and false beards.[9] In addition to the blackjack activities, Thorp had assembled a baccarat team which was also winning.[9]
News quickly spread throughout the gambling community, which was eager for new methods of winning, while Thorp became an instant celebrity among blackjack aficionados. Due to the great demand generated about disseminating his research results to a wider gambling audience, he wrote the book Beat the Dealer in 1966, widely considered the original card counting manual,[11]which sold over 700,000 copies, a huge number for a specialty title which earned it a place in the New York Times bestseller list, much to the chagrin of Kimmel whose identity was thinly disguised in the book as Mr. X.[6]
Thorp's blackjack research[12] is one of the very few examples where results from such research reached the public directly, completely bypassing the usual academic peer review process cycle. He has also stated that he considered the whole experiment an academic exercise.[6]
In addition, Thorp, while a professor of mathematics at MIT, met Claude Shannon, and took him and his wife Betty Shannon as partners on weekend forays to Las Vegas to play roulette and blackjack, at which Thorp was very successful.[13]His team's roulette play was the first instance of using a wearable computer in a casino — something which is now illegal, as of May 30, 1985, when the Nevada devices law came into effect as an emergency measure targeting blackjack and roulette devices.[2][13] The wearable computer was co-developed with Claude Shannon between 1960–61. Thefinal operating version of the device was tested in Shannon's home lab at his basement in June 1961.[2] His achievements have led him to become an inaugural member of the Blackjack Hall of Fame.[14]
He also devised the 'Thorp count', a method for calculating the likelihood of winning in certain endgame positions in backgammon.[15]
Stock market[edit]
Since the late 1960s, Thorp has used his knowledge of probability and statistics in the stock market by discovering and exploiting a number of pricing anomalies in the securities markets, and he has made a significant fortune.[5] Thorp's first hedge fund was Princeton/Newport Partners. He is currently the President of Edward O. Thorp & Associates, based in Newport Beach, California. In May 1998, Thorp reported that his personal investments yielded an annualized 20 percent rate of return averaged over 28.5 years.[16]
Bibliography[edit]
- (Autobiography) Edward O. Thorp, A Man for All Markets: From Las Vegas to Wall Street, How I Beat the Dealer and the Market, 2017. [1]
- Edward O. Thorp, Elementary Probability, 1977, ISBN0-88275-389-4
- Edward Thorp, Beat the Dealer: A Winning Strategy for the Game of Twenty-One, ISBN0-394-70310-3
- Edward O. Thorp, Sheen T. Kassouf, Beat the Market: A Scientific Stock Market System, 1967, ISBN0-394-42439-5 (online pdf, retrieved 22 Nov 2017)
- Edward O. Thorp, The Mathematics of Gambling, 1984, ISBN0-89746-019-7 (online version part 1, part 2, part 3, part 4)
- Fortune's Formula: The Untold Story of the Scientific Betting System That Beat the Casinos and Wall Street by William Poundstone
- The Kelly Capital Growth Investment Criterion: Theory and Practice (World Scientific Handbook in Financial Economic Series), ISBN978-9814293495, February 10, 2011 by Leonard C. MacLean (Editor), Edward O. Thorp (Editor), William T. Ziemba (Editor)
See also[edit]
References[edit]
- ^Peter A. Griffin (1979) The Theory of Blackjack, Huntington Press, ISBN978-0929712130
- ^ abcEdward O. Thorp. 'The Invention of the First Wearable Computer'(PDF). Edward O. Thorp & Associates. Retrieved April 26, 2010.
- ^'Founding professor of math donates personal, professional papers to UCI Libraries'. UCI News. UC Irvine. June 12, 2018.
- ^Understanding Fortune’s Formula by Edward O. Thorp Copyright 2007 Quote: 'My 1962 book Beat the Dealer explained the detailed theory and practice. The “optimal” way to bet in favorable situations was an important feature.In Beat the Dealer I called this, naturally enough, “The Kelly gambling system,” since I learned about it from the 1956 paper by John L. Kelly.'
- ^ abTHE KELLY CRITERION IN BLACKJACK, SPORTS BETTING, AND THE STOCK MARKET by Edward O. Thorp Paper presented at: The 10th International Conference on Gambling and Risk Taking Montreal, June 1997
- ^ abcdeDiscovery channel documentary series: Breaking Vegas, Episode: 'Professor Blackjack' with interviews by Ed and Vivian Thorp
- ^The Tech (MIT) 'Thorpe, 704 Beat Blackjack' Vol. 81 No. I Cambridge, Mass., Friday, February 10, 1961
- ^ ab'American Scientist online: Bettor Math, article and book review by Elwyn Berlekamp'. Archived from the original on April 23, 2007. Retrieved March 18, 2006.CS1 maint: BOT: original-url status unknown (link)
- ^ abcdIt's Bye! Bye! Blackjack Edward Thorp, the pensive professor above, is shaking the gambling world with a system for beating a great card game. He published it a year ago, and now the proof is in: it works David E. Scherman January 13, 1964 pp. 1–3 from SI Vault (beta)(CNN) Quotes: 'The unlikely trio was soon on its way to Reno and Lake Tahoe, where Thorp's horn-rimmed glasses, dark hair and fresh, scrubbed face hardly struck terror into the pit bosses. (p. 1)', 'But Edward Thorp and his computer are not done with Nevada yet. The classiest gambling game of all—just ask James Bond—is that enticing thing called baccarat, or chemin de fer. Its rules prevent a fast shuffle, and there is very little opportunity for hanky-panky. Thorp has now come up with a system to beat it, and the system seems to work. He has a baccarat team, and it is over $5,000 ahead. It has also been spotted and barred from play in two casinos. Could it be bye-bye to baccarat, too? (p. 1)' and 'But disguises frequently work. Thorp himself now uses a combination of wraparound glasses and a beard to change his appearance on successive Las Vegas visits. (p. 3)'
- ^Breaking Vegas “Professor Blackjack.”Archived December 21, 2008, at the Wayback Machine Biography channel Rated: TVPG Running Time: 60 Minutes Quote: 'In 1961, lifelong gambler Manny Kimmel, a 'connected' New York businessman, read an article by MIT math professor Ed Thorp claiming that anyone could make a fortune at blackjack by using math theory to count cards. The mob-connected sharpie offered the young professor a deal: he would put up the money, if Thorp would put his theory to action and card-count their way to millions. From Thorp's initial research to the partnership's explosive effect on the blackjack landscape, this episode boasts fascinating facts about the game's history, colorful interviews (including with Thorp), and archival footage that evokes the timeless allure and excitement of the thriving casinos in the early `60s. '
- ^'Blackjack Hero profile'. Blackjackhero.com. Retrieved April 26, 2010.
- ^A favorable strategy for twenty-one. Proceedings of the National Academy of Sciences 47 (1961), 110-112
- ^ ab'Poundstone, William: Fortune's Formula : The Untold Story of the Scientific Betting System That Beat the Casinos and Wall Street'. Retrieved April 26, 2010.
- ^Anthony Curtis. 'Las Vegas Advisor on Ed Thorp'. Lasvegasadvisor.com. Retrieved April 26, 2010.
- ^Chuck Bower (January 23, 1997). 'Cube Handling in Races: Thorpe count'. bkgm.com. Backgammon Galore. Retrieved May 8, 2013.
- ^'Thorp's market activities'. Webhome.idirect.com. Archived from the original on October 31, 2005. Retrieved April 26, 2010.
Sources[edit]
How To Write A Blackjack Program In Computer
- Patterson, Scott D., The Quants: How a New Breed of Math Whizzes Conquered Wall Street and Nearly Destroyed It, Crown Business, 352 pages, 2010. ISBN0-307-45337-5 via Patterson and Thorp interview on Fresh Air, February 1, 2010, including excerpt 'Chapter 2: The Godfather: Ed Thorp'
External links[edit]
- Edward O. Thorp at the Mathematics Genealogy Project
Links - Jump to:
How To Write A Blackjack Program In C Language
Complete Delphi Projects - Source Code and Executable files available as
separate files (.zip archives)
Delphi Components With Source Code
Freeware components by Other People With Source Code.
How To Write A Blackjack Program In C++
<<< Complete Delphi Projects >>>(all include .exe files in case you don't want to compile it)(full source code, as 2 -- or more separate files) | |
Guess the Animal Game v0.01 beta | |
Draw Poker v0.03 for Delphi.This is a port of Draw Poker v3.3 by Robert A Woodring II, written in C language. The original C source code version is available from: | |
poker_003_src.zip 15 KB - The Delphi source files. | |
poker_003_exe.zip 228 KB - The executable file. | |
Colour_Life v1.0 - Game of Life in Colour. | |
color_life_1_src.zip 15KB - The Delphi source files. | |
color_life_1_exe.zip 225KB - The executable file. | |
Roman number converter.This application program has a simple interface. Simply enter the Arabic number (e.g. 1234 or 456 or 777 or 9873 ... an integer using decimal digitals) and click on the button 'Convert to Roman numbers' and it will appear in the box for Roman Number. Alternatively, enter a Roman Number in the box and click on the button 'Convert to Arabic Number' and it will appear in the Arabic Number box. | |
arabic_roman_src.zip 6 KB - The Delphi source files. | |
arabic_roman_exe.zip 162 KB - The executable file. | |
Tank game v0.06This is a little game where you are a man standing in a playing grid (a TStringGrid in Delphi) and you are surrounded by robots and mine -- you are in a mine field. You can move in one of nine directions and each time you move, the robots move one step closer to you. If you touch a robot or mine, then you will die. You can also use a sonic-screwdriver - which will kill any robot immediately next to you. You also have a limited number of teleports (random move)... but be careful because you may land on a robot or mine, in which case you will die. | |
tank_006_src.zip 24 KB - The Delphi source files. | |
tank_006_exe.zip 225 KB - The executable file. | |
Frog! Game version 0.05bMake the Frog eat flies to survive. Retro game based on old Commodore PET game. New version uses TPaintBox component instead of TImage and this seems to fix known previous bugs. Now frog changes colour as he eats bugs (new to 0.05a). IMPORTANT ANNOUNCEMENT:This project is now on -- http://sourceforge.net/projects/frog-retro-game/ Please visit the above URL link for the latest release of the Source code & Executable files. | |
Frog_005b_src.zip 243 KB - The Delphi source files. | |
Frog_005b_exe.zip 395 KB - The executable file. | |
Frog_waves.zip 281 KB - Some sound wave files you will need. | |
Frog_waves2.zip 898 KB - Another sound wave file you will need. | |
AI-Life v0.02aIs a zero player which simulates an environment where plants and critters grow and compete. | |
ai_life_002a_src.zip - 351 KB - The Delphi source code files only (includes original version by different author) | |
ai_life_002a_exe.zip 309 KB - The .exe and .hlp files | |
You will also need the component TGprogress.gprogress_src.zip 23 KB - The Delphi source code files only | |
Chop_n_Join v0.06dChops large files into smaller files (typically floppy diskette size - but can be any size), and also joins them together (with .hlp file). xxx | |
chop_n_join_006d_src.zip 11 KB - The Delphi source code files only | |
chop_n_join_006d_exe.zip 292 KB - The .exe and .hlp files | |
Do the Macarena 0.02Watch this little guy (Mr Ascii) dance the Macarena !!! Fun. Stolen (er... converted to Delphi) from SWAG Pascal archives ( http://www.gdsoft.com/swag/downloads.html )You will need these 2 components:TFormResizer 2.0 ... http://www.delphi32.com/vcl/1289/ TThreadedTimer 1.2a ... http://www.delphi32.com/vcl/3086/ | |
macarena_003_src.zip 9KB - The Delphi source code files only (also includes original SWAG Pascal code) | |
macarena_003_exe.zip 174 KB - The .exe file. | |
macarena_004_src.zip 9KB - The Delphi source code files only (also includes original SWAG Pascal code) | |
macarena_004_exe.zip (updated 15 Dec 2005) 173KB - The .exe file. | |
Kylix 3 For Linux Source Code - | |
GoMoku the game v0.04Played on a 15x15 board, the object of the game is to get 5 pieces in a row before the computer can. Here is an article about the program which I will rewrite in the next few weeks (10 Mar 2002) (maybe I'll get around to rewrite the detailed artice... one day :-))) maybe, maybe not... it's not a high priority :-))) Read my article which I wrote way back in 2002 and have updated it in March 2010. It is a plain html document.... e.g. if you can view this page then you'll be able to view the article also. Link (URL): Go-Moku Game - My Approach To Writing It In Delphi by Peter E. Williams (yours truly) !!! ;-)) to the text html article where I describe how I went about so of the basics of designing the Artificial Intelligence logic for how the computer figures out where to move. The logic is pretty good !!! ;-0)) Enjoy. ;-))) | |
omoku_004_exe.zip 244 KB - The .exe file for the game | |
gomoku_004_src.zip 33 KB - The Delphi source code files only | |
Guess the Animal Gamev0.01 beta | |
animals_exe.zip 168 KB - The .exe and .dat files for the game | |
animals_src.zip 9 KB - The Delphi source code files only | |
Hunt the Wumpuz'Hunt The Wumpuz' (c) 1996-2002 by Peter E. Williams, based in concept only on the game 'Hunt the Wumpus' by Gregory Yob. Note this is Windows clone of Mr Yob's original game. If you enjoy this game then you should thank Mr Yob for inventing his game (many years ago), as I do. All of the code for this game was written by me (except the component for displaying the .gif map, which is freeware). I wrote it because I enjoyed the original and there was no Windows version. It is a simple game and was fun to write. This game is Freeware open source (written in Delphi 5), and I think Mr Yob's game was also open source. Mr Yob's game was published in computer magazines and books. I am not making nor attempting to make a single cent from this game. Note: if you want to re-compile this program then you will need TGifImage 2.2 from http://www.melander.dk/delphi/gifimage/ (TGIFImage Home page). | |
wumpuz_002a_exe.zip 216 KB - The .exe file for the game (including map & instructions files) | |
wumpuz_002a_src.zip 23 KB - The Delphi source code files only (including map & instructions files) | |
Nuclear the game v0.03aIs a fun game against the computer. A simple board game ... hard to beat. | |
nuclear_003a_exe.zip 228 KB The .exe and .hlp files for the game | |
nuclear_003a_src.zip 28 KB The Delphi source code files only | |
Simple Ed v0.05Is a simple text-only editor written using tmemo component. Allows multiple editor files to be open, line & col counters on edit file's window caption, tiling & cascading of windows. Recent files opened/saved list implemented via an inifile. Basic but a simple guide to how to do it. Could easily be modified to use trichedit component with addition of toolbar buttons for richtext effects (e.g. underlining, bolding, etc) ... these features were deliberately omitted since this is a text-only editor. | |
simple_ed_005_exe.zip 194 KB - The .exe file for the game | |
simple_ed_005_src.zip 19 KB - The Delphi source code files only | |
Snake Game v0.01(Version #??) original by '//hIDRA_5' with modifications by PEW The original snake game for Delphi was by //hIDRA_5, and can be downloaded I am one of many people who have visited the above site and downloaded the source to the original game. The attached files form the new version of the snake game, as modified, enhanced and debugged by myself. I am sending this new version (0.01) including this file, to //hIDRA_5, in the hope that it will become the 'official' next version, replacing the original. Firstly, I would like to thank '//hIDRA_5' for sharing his source code and cool little game with the rest of the world. I hope that the new version will be accepted as an improvement to it. :-))) It seem that '//hIDRA_5' after my many attempts to contact him, has decided to ignore my new version, so I am making it available here. | |
snake_001_exe.zip 308 KB - The .exe file for the game and fonts. | |
snake_001_src.zip 124 KB - The Delphi source code files and fonts. | |
Tragic PoetThis is a cute little program which I found on the internet in Commodore 64 BASIC source code and which I have converted to a Delphi program. It's not the greatest example of Delphi since it was originally written in BASIC - note I have debugged it to make it operate correctly. It will generate the required number of lines of random poetry. Original author unknown. Also included is the original C64 BASIC program and a text listing of the Commodore BASIC program (as a .bas file), as produced by a Commodore emulator. | |
tragic_poet_exe.zip 180 KB - The .exe file and the original C64 program and text basic listing. | |
tragic_poet_src.zip 6 KB - The Delphi source code files only | |
How To Write A Blackjack Program In Python
DColorButton v0.04dcolorbtn_004_src.zip 10KB A descendant of tbutton with colour background and text. (with sample project). The component publishes 3 properties: DownColor -- the color of the button when it is 'down' -- e.g. when you click on it and hold down the mouse button the button will be this color. DisabledColor -- the color of the button when Enabled := false NB -- Test project contains a number of buttons and 1 timer and toggles the enabled property to show how the appearance of the buttons change in different states. |
ArrayColorButton v0.02arraycolorbtn_src.zip 8KB A descendant of tbutton with colour background |
Label3dlabel3d_src.zip 9KB A descendant of tlabel with 3D effects, |
Richbuttonrichbtn_src.zip 17KB A button with a richedit face. |
How To Write A Blackjack Program In C Programming
myinifiles.txtIntructions on how to make the MyIniFiles.pas unit, which is a modified version of Borland's IniFiles.pas |
BTBeeper 0.06 ComponentBTOdeum.pas component is a freeware beeper Delphi component. With full source. by Theodoros Bebekis, Thessaloniki, Greece, available from: Delphi Super Page (DSP) at and Torry's page at |
TFormResizer 2.0 componentEasysize.pas () is a freeware component for Delphi (1..5). 'The TFormResizer component resizes all of the components on a form when the form size changes.' With full source. available from: Delphi32.com at http://www.delphi32.com/vcl/1289/ |
TStringAlignGrid You will need the tStringAlignGrid component for some of my programs. Below is the contact details. Just go to the website below and download the latest version of tStringAlignGrid and install it. With full source. Contact: Andreas Hoerstemeier, email: andy@hoerstemeier.de available from: http://www.hoerstemeier.com/ |
TCard Is a component for drawing graphical cards for card games. Freeware, with full source. 'Show cards and decks, with no additional DLLs.' by: Giulio Ferrari |