Python Blackjack Simulator

Ғылым және технология

Building a quick Blackjack simulator to test a theory a friend of mine had about a way to win at Blackjack.
Check out this code here:
github.com/ebrian/engineerman...
Join my Discord server to chat with me:
/ discord
Check out some code on my GitHub:
github.com/ebrian/engineerman
Tweet me something funny on Twitter:
/ _engineerman
Say hi over at Facebook:
/ engineermanyt
Sincerely,
Engineer Man

Пікірлер: 177

  • @ccnmnm
    @ccnmnm6 жыл бұрын

    I don't think the logic to calculate the dealer bust is correct. If the dealer gets an Ace, it should be converted to a 1 if the total is greater than 21. For example in the current code, if the dealer is dealt two aces, it will incorrectly count as a bust. After implementing the fix for the above, you might have another edge case for the soft 17 check: if the dealer is dealt multiple aces, they shouldn't all be converted into 1's before the next card is dealt. How I might do it is create a methods called add_card(cards, card) which will add the card to the cards list according to blackjack rules. Then you could have other methods like should_player_hit(cards) and should_dealer_hit(cards) that would do the sum < 12 or

  • @epiductions8116
    @epiductions81165 жыл бұрын

    Only this man calls Me engineer..

  • @DavidWoodMusic
    @DavidWoodMusic5 жыл бұрын

    This got me through my last lab for my intro to Comp Si course. Thanks my dude.

  • @chaselamoureux9177
    @chaselamoureux91775 жыл бұрын

    Great video! Like seeing how you step through the logic. Helps to see the initial idea and then how to build it in a program.

  • @Sawta
    @Sawta3 жыл бұрын

    I really liked your videos on messing with scammers, and using web scraping. I'd like to see more hands on practical stuff like that, videos with something like "Here's a common problem you have, and how to fix it with programming." It's super neat!

  • @jason_molenda
    @jason_molenda6 жыл бұрын

    what happens if you score a player blackjack as a 1.5?

  • @texiphone
    @texiphone6 жыл бұрын

    Hey, nice bit of work! I had to think about this one for a bit and bounced back and forth, but it may be important to look into the effect that pseudo-random numbers has here. You have avoided one pitfall by pre-shuffling the decks, but you call a new deck in parallel. What I'd like to know is how the parallelism affects the efficacy of randomising decks, and if seeding random each time the thread shuffles decks would affect the outcomes? I shall try it and let you know! Thought that might be a cool thing to talk about, as pseudo-random is a pain in the arse for things like this, and most people who are starting out often overlook this critical aspect of random numbers in computing.

  • @pizzamark4388

    @pizzamark4388

    5 жыл бұрын

    you can see that the results are different by 0.2% every time which means that the random seed is different every time

  • @NateRoberts
    @NateRoberts3 жыл бұрын

    This was super cool! I wish I knew more about threading and processes so I could try stuff like this. Now I will watch the rest of the show and tells

  • @AureliusAurelius
    @AureliusAurelius6 жыл бұрын

    What is your favorite python programming book for intermediate programmers?

  • @lillydlc1747
    @lillydlc17475 жыл бұрын

    I'm hooked to your python videos! Awesome

  • @smccrode
    @smccrode5 жыл бұрын

    This is awesome. I like the intermediate python walk through.

  • @unbeirrbarde
    @unbeirrbarde5 жыл бұрын

    Excellent stuff, great to learn Python for me. Thank you for this format.

  • @patrickpalmerini745
    @patrickpalmerini7454 жыл бұрын

    I really like this kind of videos. Always very useful and interesting!

  • @viper33802
    @viper338026 жыл бұрын

    I liked this video. Thank you. I think this looks like it would be a fun project to build more logic into so that we can see if you are able to find a strategy with a higher win percentage. Can we factor in soft aces for the player? Or possibly simulate multiple players with different strategies.

  • @johnbarney2809
    @johnbarney28093 жыл бұрын

    i know i’m 2 years late to the party but i’ve been watching a bunch of your videos and they’re great. thank you for the content ❤️

  • @EngineerMan

    @EngineerMan

    3 жыл бұрын

    You're welcome :)

  • @Outthebots
    @Outthebots5 жыл бұрын

    can you change up the hardcoded rules to find if any similar starts have better results?

  • @lillydlc1747
    @lillydlc17475 жыл бұрын

    I have an issue with the multiprocessor lib. Anyone else fails to install this?

  • @johngaltline9933
    @johngaltline99334 жыл бұрын

    I'm curious how the example strategy plays out taking in to account player losing on dealer 21 and/or player winning 3/2 (1.5 wins) on 21.

  • @djcaesar9114
    @djcaesar91144 жыл бұрын

    What is your Atom plugin to have the thumbnail of your code in the corner?

  • @porlando12
    @porlando125 жыл бұрын

    This was great! You should use htop next time so we can really see all those cores spinning at 100%!

  • @ShadiDK
    @ShadiDK5 жыл бұрын

    Interesting project. I am completely new to Python, so tried to pull your code from git just to try it out locally. I do however get some errors (listed below). line 118, in process.start() line 112, in start self._popen = self._Popen(self) line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) line 322, in _Popen return Popen(process_obj) line 33, in __init__ prep_data = spawn.get_preparation_data(process_obj._name) AttributeError: module 'multiprocessing.spawn' has no attribute 'get_preparation_data' Any Idea what I am doing wrong ?

  • @endlacer
    @endlacer6 жыл бұрын

    line 51: If the dealer got two Aces (AA) doesn't this method convert both of them to 1's ?

  • @jonnyde
    @jonnyde4 жыл бұрын

    Is there a way to join the BJ table after the dealer has had a certain number of wins, or % of wins in last # of hands, etc? In a casino you dont always stay at a table if you feel that the dealer is 'hot' etc. Also money management is not touched at all in this version: any thoughts on how that can be added (ie let winnings ride until reach certain amount and then go back to $start value etc OR increase/decrease $ if last hand was won/lost, or if dealer busts, etc)

  • @FedericoTrentonGame
    @FedericoTrentonGame5 жыл бұрын

    Very cool, I wonder if adapting the same code to work with the "cheatsheet" you find online on how to bet will give best odds.

  • @Xpegasu
    @Xpegasu6 жыл бұрын

    LOVE this!!! Do more, please

  • @bradleaman
    @bradleaman5 жыл бұрын

    can you do a video on how to shuffle a deck of cards and as someone picks one. that card is eliminated from the deck?

  • @johngiraldi1150
    @johngiraldi11505 жыл бұрын

    Blackjack for the player usually pays 1.5 to 1 and the probability of hitting blackjack is 4.83% of the hands played. Your strategy already has a push for both dealer and player having blackjack simultaneously and assuming there are no errors in your simulation (actual rules of blackjack) as well as each hand having an equal bet then the player has an effective win rate of 47.81%. Add a few other player positive strategies and it could be the effective win rate is even higher. The Python code is awesome!

  • @EzraSchroeder
    @EzraSchroeder Жыл бұрын

    @3:08 isn't it bad to change a list while you're looping over it??? Please explain! Thank you!

  • @masterjiggle5728
    @masterjiggle57286 жыл бұрын

    I am waiting for your machine learning and deep neural nets tutorials Already know what they are and how it works but want to see your tutorials

  • @MattLGreer
    @MattLGreer2 жыл бұрын

    If I manually set cpus = 1, why are the percentages off?

  • @Tomlawson944
    @Tomlawson9445 жыл бұрын

    That was class haha! God, I wish I program like that lol Defo do another similar video, I really enjoyed it! :D

  • @SamitMohan
    @SamitMohan6 жыл бұрын

    Which wallpaper do you use

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    Something I found on Google Images.

  • @gandsnut
    @gandsnut6 жыл бұрын

    Given we see multiple 'python' appear in the process list, does this mean multiple executions of the Python interpreter have been loaded? And if so, is there some mechanism for each copy of the interpreter to know how to run only the section of code that is 'threaded'? I've dabbled with fork() and exec() in 'C', but never done the deep study of those. The fact Python is being interpreted is an additional brain-twist to grapple with... Thx.

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    So with the Python mp module, you specify a target function to begin execution on. In my case here, that function is "simulate". That effectively becomes the starting point for the new process and each process starts there on it's on thread of execution and with a copy of the current address space (this address space is not shared though, however sharing can be accomplished). So in short: the Python interpreter knows what to execute because you must tell it where to begin when you fire up the 2nd, 3rd, 4th, etc. process.

  • @svenskithesource1130
    @svenskithesource11304 жыл бұрын

    Could you make a program where you try different strategies to find the best one?

  • @bits_for_bytes
    @bits_for_bytes6 жыл бұрын

    Subbed, great content

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    Glad you like it!

  • @urgedduke
    @urgedduke5 жыл бұрын

    It would have been interesting to see if you ran another cpu intensive task to increase entropy on your system while your blackjack simulation was going on. You may have gotten more variation from your RNGs and thus more variation between runs

  • @qpdbqpdb1
    @qpdbqpdb19 ай бұрын

    Hey! I'm getting an error related to starting several processes "before the current process has finished its bootstrapping phase". Is there a block of code that I need to add when I'm on Windows? Comes from before even running the simulation. It's at multiprocessing.Queue() , cheers!

  • @shuey134
    @shuey1343 жыл бұрын

    This was interesting. I made something similar for craps and noticed the win/lose percentages are almost exactly the same each time I run it with the losses being higher. Guess that's why casinos play these games, they always have the odds.

  • @Qibbles
    @Qibbles6 жыл бұрын

    Just to verify, the multiprocessing part is to run 32 simulations at once and it’s not needed (but will take a long long time to complete)?

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    Yep. Just makes your calculations go 32x faster (or however many cores you have).

  • @sogbryan6633
    @sogbryan66335 жыл бұрын

    The results are surprising; because typical is: Player 42%, Push 8%, Dealer 48%. But I guess it depends on the rules.. surrender etc. Thx for the vid.

  • @pearsonlucas
    @pearsonlucas5 жыл бұрын

    Maybe I'm wrong but couldn't a table have more then just the dealer and you. It would interesting to see more player hands and how their strategies could affect this one. Might have to try that in Go for a learning exercise. Awesome video.

  • @ap0ught
    @ap0ught5 жыл бұрын

    thanks really liked the example of using multiple processes to chew on one major task

  • @EngineerMan

    @EngineerMan

    5 жыл бұрын

    High core machines are always underused.

  • @JamesHauffa
    @JamesHauffa3 жыл бұрын

    I think it would be cool to calulate professional sport player stats with the number they are assigned to see if there is a correlation to number and success. It would also be cool to know which number is used the most.

  • @2Calam
    @2Calam2 жыл бұрын

    Wow, how amazing are modern processors!!!

  • @berkl001
    @berkl0016 жыл бұрын

    Hey, I'm new to Python, could somebody explain to me how the core stuff at the end works. Basically I've created my own code (which I'm happy to share) which does a similar thing to this - however when I run my code the CPU goes to about 99.9% and it freezes the terminal. - Not sure how I edit my code so that it uses less CPU? Thanks in advance guys - great video as always Engineer Man!

  • @ramgopalvarma5949
    @ramgopalvarma59495 жыл бұрын

    Great simulation Video. Thanks for the Video

  • @EngineerMan

    @EngineerMan

    5 жыл бұрын

    You bet!

  • @durimmiziraj4815
    @durimmiziraj48156 жыл бұрын

    Great video, great channel!

  • @randomhominid9816
    @randomhominid98163 жыл бұрын

    Very nice. Subbed.

  • @EzraSchroeder
    @EzraSchroeder Жыл бұрын

    @3:41 in general instead of having 4 separate "if" statements in a row, since they are all testing the logic around one concept and are all related, wouldn't it be better to have this like "if, elif, elif, else"? Wouldn't that latter way be more logically comprehensive in general & less prone to error?

  • @noweare1
    @noweare14 жыл бұрын

    How would someone find libraries in C that do what you can do here in python ?

  • @EngineerMan

    @EngineerMan

    4 жыл бұрын

    You can find them mostly as open source projects on GitHub. C has a very small standard library and the language itself is simple. The standard library for Python implements many things as part of core Python. C is not like this, you gotta do it yourself (or find libraries made by people that did it themselves).

  • @chucknorris8351
    @chucknorris83516 жыл бұрын

    Channel is great, I’m laughing at some of the black jack dorks in here, keep on rocking bud.

  • @edgar26231
    @edgar262314 жыл бұрын

    Grate videos on this channel

  • @blyteplays9748
    @blyteplays9748 Жыл бұрын

    Can your sim, account for splits and double down situations? Or a graduated betting strategy, out to 8x? I use a similar strategy to bob, but I get aggressive when the dealer has a crummy card showing, trying to split and double down as much as I can, in those situations. Also I will double my bet on losses, out to 8x.. I do really well on free google game sims, when I start with a 1k bank roll, on a $10 minimum table, which stands on all 17s

  • @paolatopi4995
    @paolatopi49955 жыл бұрын

    copy paste the code and it has a lots of erros, sintax erros and notdefinded name errors... why?!

  • @Tehbestestevasss
    @Tehbestestevasss3 жыл бұрын

    I would argue that a draw is not consider as a loss, and is actually considered as a win, as you do not lose your money and can replay that money again. Therefore, 52% win to 48% loss (on average) is not that bad. More often than not you will be coming out on top. However, as others have already pointed out, stuff like multiple aces being dealt to the dealer immensely screws with your system as it counts as an auto bust and fixing that would cause soft 17's to break. I'd be curious how it would turn out with fixes like these implemented.

  • @ericbeard7007
    @ericbeard70074 жыл бұрын

    Nice interesting and to point

  • @kevinhansen2499
    @kevinhansen24996 жыл бұрын

    I'd like to see how greater the win percentage is if you make your character count the cards. Because people get thrown out of casinos for doing it. So I suppose it makes you win instead of the house? Edit: Second thoughts. It might not increase the win percentage overall, but the chance of you scoring big. You could try to give the dealer a fixed amount of cash as well the player, and see if the player can bankrupt the dealer.

  • @nielscallese8122
    @nielscallese81226 жыл бұрын

    Top tip: Putting Python in the title would allow a lot more people to find this excellent tutorial.

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    Oooo I like this.

  • @nielscallese8122

    @nielscallese8122

    6 жыл бұрын

    You do quality content, I figure others would like to find it as well.

  • @giacomociarlini4557
    @giacomociarlini45576 жыл бұрын

    great video. continue

  • @AkinWale
    @AkinWale5 жыл бұрын

    Great Video

  • @Bane771
    @Bane7716 жыл бұрын

    I was wondering if you could explain to me how the card dealing works in this simulator with the pop function. Im trying to learn python so any help is highly appreciated

  • @diegomastro5681

    @diegomastro5681

    6 жыл бұрын

    Pop takes out last item of an array and you can use it, so what you do is pop the last card from the deck, and append it to player hand, then you do the same for dealer. Example your deck looks like this [3,7,5,9] You pop the 9 and add it to player hand Deck = [3,7,5] P_hand = [9] Then you do the same for dealer Deck = [3,7] P_hand = [9] D_hand = [5] And so on.. If you didnt understand something or have further questions just ask

  • @Bane771

    @Bane771

    6 жыл бұрын

    Diego Mastro Thanks, although i dont understand how that is random in this case if you pop out the last element of the array. Sorry for my bad knowledge

  • @diegomastro5681

    @diegomastro5681

    6 жыл бұрын

    S3mp3rFi you shuffle the deck beforehand, in line 26: random.shuffle(std_deck). And one thing I didnt say but you may have known that, pop gets the last element from an array and then deletes it from the array, so if you keep popping you keep getting different cards

  • @Bane771

    @Bane771

    6 жыл бұрын

    Diego Mastro oh right. Cheers mate!

  • @diegomastro5681

    @diegomastro5681

    6 жыл бұрын

    S3mp3rFi Glad to help, good luck pythoning :)

  • @Shaharskywalker
    @Shaharskywalker6 жыл бұрын

    This is very cool!

  • @Jamie-zs4yc
    @Jamie-zs4yc2 жыл бұрын

    The real way to win is to follow the rule: Everytime you lose, double your next bet, everytime you lose go back to the original start bet. Would be good if you could do this but obviously they do not allow you to do it.

  • @TheSveum
    @TheSveum3 жыл бұрын

    Great video. You need some better lights and camera thought

  • @denzelgregory5568
    @denzelgregory55684 жыл бұрын

    Change Bob's number to 16. Percentage changes drastically.

  • @Kahitar
    @Kahitar6 жыл бұрын

    I loved this video! Can you use this to find the absolute BEST strategy for playing blackjack? :P

  • @bokkenka

    @bokkenka

    6 жыл бұрын

    It would take a lot more programming to find the ABSOLUTE BEST strategy. This one does not check if the player busts (goes over 21). You would have account for that, and splitting, and insurance, and black jacks, and a whole slew of other occurrences.

  • @BernhardHofmann
    @BernhardHofmann3 жыл бұрын

    You could simulate different strategies to find the optimal one. I still don't think you would find a winning strategy, but maybe you could tell Bob that 14 or 15 is better than 12?

  • @GonzaSePe
    @GonzaSePe6 жыл бұрын

    Great video! Keep it up!

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    Thank you and thanks for coming back.

  • @sqaureknep6244
    @sqaureknep62443 жыл бұрын

    awesome

  • @joebonsaipoland
    @joebonsaipoland5 жыл бұрын

    Change the stand at 12 to 13 or 14 and see if the results change.

  • @def-qy8rc
    @def-qy8rc6 жыл бұрын

    When I run the code, it gives a runtime error, says I tried to start a new process before the current process has finished its bootstrapping phase

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    I think you're on Windows maybe? Somebody on my Discord ran into this same problem. I don't recall the solution.

  • @def-qy8rc

    @def-qy8rc

    6 жыл бұрын

    Do you have to be on linux? If so, what version do you recommend?

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    You don't, but, because of the way multiprocessing works, the code is slightly different on Windows. Windows doesn't have fork/exec like Linux does.

  • @jeffhehir5717

    @jeffhehir5717

    5 жыл бұрын

    I had the same issue, (yes it is a windows issue) but was able to get it working by putting everything from "for i in range(0, cpus):" through the last print into a function. def main(): and then adding if __name__ == '__main__': main() at the end of the script

  • @lalofuentes3381

    @lalofuentes3381

    Жыл бұрын

    @@jeffhehir5717 It worked on Windows, but I had to figure out the correct line is if __name__ == '__main__': (name with two underscores 😃)

  • @sogbryan6633
    @sogbryan66335 жыл бұрын

    Engineer Man MILLION VIEW VIDEO IDEA!! Please do an update on your "Never Bust" Vid; try a video on blackjack simulator test on #1- "stand" (never bust) on all 16's". And #2- "hit all 2 card 16's (normal BJ), but stand on all 16's using 3(or more) cards". I think the WHOLE Blackjack community would be interest to see the video results of that simulation!! Let me know, thx.

  • @MichaelGarcia-cg9on
    @MichaelGarcia-cg9on5 жыл бұрын

    Nice video.

  • @ZER0--
    @ZER0--5 жыл бұрын

    Any chance you could test The Martingale System on a roulette wheel simulation with just one 0. In theory it makes logical sense but in reality it doesn't.

  • @TuxMan20

    @TuxMan20

    5 жыл бұрын

    The flaw in the Martingale system is the table bet limit. Once you hit a bad streak and you need to bet over the table limit, you lost.

  • @clarkmerchant2

    @clarkmerchant2

    5 жыл бұрын

    I've simulated this every which way from Sunday - in a 47.5/52.5 (red or black) bet sequences and non sequences can go into the hundreds and to infinity over enough time. Bet limits are the least of the problem, when you use Martin gale with roulette.

  • @clarkmerchant2

    @clarkmerchant2

    5 жыл бұрын

    Sorry I meant 48.65/48.65 my maths ain't up to much today.

  • @followthetrawler
    @followthetrawler6 жыл бұрын

    love to see you do an anagram solver in python - 9 random letters test what is the longest valid word you can make

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    That's an interesting idea...

  • @dolodestinations7628
    @dolodestinations7628 Жыл бұрын

    Love the video. But shouldn’t decide if this is a good strategy based on comparing win percentage to lose percentage to itself. Should compare it to win percentage of basic strategy. If basic strategy gets you a win of 35% of the time. Then this strategy is significantly better

  • @jtc1947
    @jtc19475 жыл бұрын

    Poor "BOB" Unless a person is some kind of really good cheat? THE HOUSE ALWAYS WINS!

  • @ZER0--

    @ZER0--

    5 жыл бұрын

    Trump's didn't.

  • @tcgvsocg1458
    @tcgvsocg14583 жыл бұрын

    I am here because tech with tim say your good...and...oh man your good your really good thx a lot You don t speak to say nothing You don t say your life like a star You don t nose like:" heuuu" "huuuum"" iam tired" every 30sec sooo Thx a lot

  • @Krebzonide
    @Krebzonide4 жыл бұрын

    It would be cool if you changed the code to test each number which you stand on and make a graph to see which is highest. I bet 16 or 17 will be and that's why the casino chose it.

  • @khanezflouss
    @khanezflouss4 жыл бұрын

    change bob's number to 18, you get this win percentage: 80.39% draw percentage: 8.05% lose percentage: 11.55%

  • @EngineerMan

    @EngineerMan

    4 жыл бұрын

    You'd then need to account for the possibility of Bob busting.

  • @RoiGabay
    @RoiGabay5 жыл бұрын

    quick note - using "deck.pop()" instead of "deck.pop(0)" would make it much faster

  • @Ayymoss
    @Ayymoss6 жыл бұрын

    Subbed

  • @abdullahsarker3595
    @abdullahsarker35953 жыл бұрын

    My god, am I confused. I'm a high school student from the UK, and we consider Blackjack and 21 as 2 separate and different games.

  • @francismori7
    @francismori73 жыл бұрын

    What if the player busts?

  • @mosk11tto

    @mosk11tto

    3 жыл бұрын

    well spotted there is that chance if player gets two aces he will bust but it isn't checked.

  • @libtardreaper1539
    @libtardreaper15394 жыл бұрын

    This has inspired me to start using python, just bought my first pc

  • @RAFAELFALA

    @RAFAELFALA

    3 жыл бұрын

    How it's going?

  • @libtardreaper1539

    @libtardreaper1539

    3 жыл бұрын

    Raphael B. My first project was tic tac toe and I enjoyed getting to understand how to put code together to create something. I started another project similar to Oregon trail but stopped before I could finish. Wondering what to do for my next project at this point

  • @jerycaryy4342

    @jerycaryy4342

    3 жыл бұрын

    @@libtardreaper1539 I usually automate tedious tasks in my life with python. Things on the computer ofc. Love your name btw.

  • @libtardreaper1539

    @libtardreaper1539

    3 жыл бұрын

    @@jerycaryy4342 haha thanks

  • @edfdf-dc2ey
    @edfdf-dc2ey6 жыл бұрын

    Damn, so lucky to get in your channel. Can you expand this blackjack simulator to blackjack APs such as myself? I wanna use an intuitive sim to run my bj strategies. Can't seem to find one on GitHub/reddit. Cs verite cost $ :(

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    You can certainly modify what's there. The code is freely available on my GitHub.

  • @jacksonuhryn8918
    @jacksonuhryn89186 жыл бұрын

    These style of videos are really awesome since it shows me functions that I haven't had experience with. Gives me something to research on google. I appreciate it being in python as well.

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    Jack Uhryn Source code on my GitHub if you'd like to run this exact program.

  • @JdsWolf
    @JdsWolf5 жыл бұрын

    What's the name of the program he's coding in?

  • @jtc1947

    @jtc1947

    5 жыл бұрын

    JDS? Should be some variation of PYTHON?

  • @JdsWolf

    @JdsWolf

    5 жыл бұрын

    @@jtc1947 I mean the IDE.

  • @stanciu9

    @stanciu9

    5 жыл бұрын

    @@JdsWolf atom

  • @paulcarr6388
    @paulcarr63886 жыл бұрын

    Add player hold If dealer has less than 7

  • @clarkmerchant2
    @clarkmerchant25 жыл бұрын

    Nice code but your deck doesn't have enough 10 cards in it and I didn't see where you allow for the dealer to play no soft 17's, maybe I missed it. I know the player isn't meant to. I think to be fair to your friend, you should also be extracting the sequence length of loses, and comparing it to the alternative strategy. Incorporating Martin gale may swing the results - which frankly look to me about the same as playing to the standard blackjack strategy, which also doesn't work, long term.

  • @pawtucketstudiouno9937
    @pawtucketstudiouno99375 жыл бұрын

    Interesting

  • @JordanHesse
    @JordanHesse5 жыл бұрын

    You should run some simulations with the martingale strategy which doubles the bet every time it loses and just maintains the same stake if it wins and playing basic strategy.

  • @ZER0--

    @ZER0--

    5 жыл бұрын

    When I first heard of the Martingale System I was like "Wow!". Then I did some research and I was like " Oh well". Just google it. It doesn't work. Best thing is to learn to card count (there are different technidues and you need a high bank roll and then you will win but it is very difficult and you can have people watching you if they get suspicious and as with any casino you can be asked to leave or try the another game. It makes me wonder how Trump could bankrupt his own casino.

  • @JordanHesse

    @JordanHesse

    5 жыл бұрын

    @@ZER0-- yeah it sounds very promising but in the long run you eventually bust out on a really bad streak. I already knew the answer to this but thought it would be an interesting video for others to watch. On your point about card counting, most casinos now have automatic card shufflers which makes it impossible to card count. Rip card counting

  • @RippedKristiyan
    @RippedKristiyan5 жыл бұрын

    :D Well played dude u rock

  • @davideres3787
    @davideres37876 жыл бұрын

    Can you do a tutorial on how to convert a .py to .exe?

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    Since Python is interpreted and not ahead-of-time compiled, creating a standalone executable is not really possible (at least not in the way you would for other languages).

  • @MW_1535

    @MW_1535

    6 жыл бұрын

    Google py2exe. I have not personally used it, but have coworkers that had success.

  • @davidwplummer953
    @davidwplummer9536 жыл бұрын

    Neural nets... neural nets... neural nets... Check out the super annoying and self-congratulatory"Code Bullet" channel, and then explain how he does what he does! Also, as a backdrop, the Windows task manager is far more beautiful than the Unix one (as is its author).

  • @_______6398
    @_______63986 ай бұрын

    Bad practice using nested functions. Better approach would be to use an object oriented approach.

  • @brianteskey2425
    @brianteskey24254 жыл бұрын

    46% is better than mainstream strategy lol

  • @yigglesmoto
    @yigglesmoto6 жыл бұрын

    I believe you missed the check to make sure the player didn't bust.

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    Yiggles Moto In my model the player cannot bust since he stands on 12 and above.

  • @yigglesmoto

    @yigglesmoto

    6 жыл бұрын

    But if I, the player, have 11 and am dealt an ace I'll be at 22?

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    Yiggles Moto Interesting, it seems you may be right. My intent was to convert that to a 1 in that case but I never did.

  • @yigglesmoto

    @yigglesmoto

    6 жыл бұрын

    I wonder how much this changes the stats/data at the end of your script.

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    Yiggles Moto I'll test it in the morning and we'll see.

  • @tehOJ11
    @tehOJ116 жыл бұрын

    FYI dealer wins all ties.

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    Since when?

  • @miccurtis4022

    @miccurtis4022

    6 жыл бұрын

    Only in certain places. For instance, I was traveling through Amsterdam and I was in the airport waiting on my flight. Well they have a small casino in that airport. I take a couple hundo and sat down only to find out that on that table the dealer wins on a push. Once I found this out, I took my 30ish dollar loss and headed out. I mean I was already playing at a disadvantage why make it a bigger gap.

  • @christofosho
    @christofosho6 жыл бұрын

    Ran it with win percentage: 49.30% draw percentage: 6.84% lose percentage: 43.86% And better still with win percentage: 53.94% draw percentage: 7.43% lose percentage: 38.63% Time to play some blackjack... ;)

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    Christopher Snow Did you also check for bust?

  • @christofosho

    @christofosho

    6 жыл бұрын

    Hahah nahh, I was just messing with the numbers while I thought about a project euler problem.. :P I'll throw that in now, didn't notice it was missing (must not have been paying enough attention).

  • @christofosho

    @christofosho

    6 жыл бұрын

    Hmm, I threw it in and came out with this (at win percentage: 48.22% draw percentage: 8.04% lose percentage: 43.74% I know you also want to look for specific pairings, based on your cards, the dealers visible card, and the other player's cards, while doing this. But that's a bit more complicated and less brute!

  • @EngineerMan

    @EngineerMan

    6 жыл бұрын

    Yeah the intent was just the simulate it, particularly with a specified system rather than any human decisions.

  • @stampede230

    @stampede230

    6 жыл бұрын

    Christopher Snow house always wins!

Келесі