Sign in to follow this  
Followers 0
GaryFrost

BlackJack/21

41 posts in this topic

#1 ·  Posted (edited)

This is my 1st game, normally I don't even look at the game scripts.

Usually to busy with applications.

Started It Saturday Night, worked on it Off and On Sunday

Cleaned it up some this morning

1 Player against the Computer

Currently this is a single deck, when the deck gets down to 10 or less and deal button is pressed cards are shuffled.

v1.2:

When the deck is depleated it is shuffled, if any cards are already dealt, those cards are not in the shuffle.

Fixed some bugs, and added the 6 card win for the user.

v1.3:

Fixed incorrect number of cards showing when drawing more than 4 cards

Fixed status messages

Changed so when shuffle after a hand, the cards on the table get removed

To Do:

Counters:

  • Win
  • Lose
  • Push

  • Average(s)
Betting:
  • Starting Amount
  • UpDown or Input for bet
  • Double Down
v2.0

Added:

4 menus

File

Exit

Config

Deck Back (Picture shown on the back of the deck)

# of Decks (1 - 8)

Sound (Shuffel Sound)

Reset Stats

Bets

$1

$5

$10

$50

$100

$1000

Help

About

Betting, starts out with $10,000 in the bank

Double Down

StatusBar (6 panels)

Dealer card total

If split left side total

If split right side total, else hand total

Win/Lose/Push

Bet

Bank

Changed/Removed

Being I have allowed multiple deck shoe, no longer display a deck of cards (Removed 52 graphic controls, added 2)

v2.1

Fixed initialization of variable from ini file

Fixed betting, not enough money no bet, no deal, no double down, no split depending on the situation

BlackJack v2.1 Skinned (No Source code)

BlackJack v2.1 No Skin (Source code)

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

pretty nice, im hanging on to this script because ive been wanting to play blackjack for a while now, i won with a jack and ace my first go :) and just now got a 20 when the comp got a 19 :ph34r:

the skinned version looks very nice as well

except at first i didnt see where it said "You win" .. but now i just noticed that it says what your cards amount up to and if your busted.. pretty neat

maybe when you do all the betting stuff, you could make it more clear that someone has won ? its completley optional, because the more i play it, the more i like it where it is, but just something to think about .. :lmao:

i like how its very clean and organized, good work :geek:

edit ok so i just looked over the code and now i see why you _ReduceMemory, all is good though

Edited by layer

FootbaG

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Have fun layer.

Haven't seen you around that much in a while.

thanks :lmao: lost interest in computers for a while.. may be back now, especially now that winter will be making its way in in a season

edit: when do you think you're gonna add the betting functions/skins ? the betting seems like it'll be really cool and the skin just looks really good :ph34r:

Edited by layer

FootbaG

Share this post


Link to post
Share on other sites

I love blackJack....this is very nice....10x :lmao:

Share this post


Link to post
Share on other sites

I keep loosing even though the dealer is busted - happen two times - you may have missed a if statement.


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

thanks :lmao: lost interest in computers for a while.. may be back now, especially now that winter will be making its way in in a season

edit: when do you think you're gonna add the betting functions/skins ? the betting seems like it'll be really cool and the skin just looks really good :ph34r:

Not sure when on the To Do List, just threw this together in pretty much a day.

The Skinned version I should have on here tonight.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Not sure when on the To Do List, just threw this together in pretty much a day.

The Skinned version I should have on here tonight.

sounds good

FootbaG

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I put a delay in so you could see that indeed you do loose if the dealer is busted - you must change it somewhere else though.

If $hit_left Then
                    $hit_left = 0
                    $UserHandTotalRight = 0
                    _Hit($a_UserHandR, $UserHandTotalRight, $deck, $a_cards, $user_cards_pic, $bdeck, "R")
                    _GUICtrlStatusBarSetText($StatusBar, @TAB & "Your Hand: " & $UserHandTotalRight, 2)
                Else
                    GUICtrlSetState($btn_hit, $GUI_DISABLE)
                    GUICtrlSetImage($dealer_cards_pic[6], @ScriptDir & "\cards\" & $deck[$a_DealerHand[2]])
                    _GUICtrlStatusBarSetText($StatusBar, @TAB & "Dealer Hand:" & $DealerHandTotal, 0)
                    Local $num_cards = 2
                    While $DealerHandTotal < 16 And $num_cards < 6
                        _Hit($a_DealerHand, $DealerHandTotal, $deck, $a_cards, $dealer_cards_pic, $bdeck, "R")
                        _GUICtrlStatusBarSetText($StatusBar, @TAB & "Dealer Hand:" & $DealerHandTotal, 0)
                        $num_cards += 1
                    WEnd
                    
                    ; this is what I added
                    If $DealerHandTotal >= 21 Then _GUICtrlStatusBarSetText($StatusBar, @TAB & "You WIN", 2)
                        sleep(10000)
                    ; end what I added
                    
                    If $is_split Then
                        _ShowStatus($DealerHandTotal, $UserHandTotalLeft, $StatusBar, 1)
                        _ShowStatus($DealerHandTotal, $UserHandTotalRight, $StatusBar, 2)
                    Else
                        _ShowStatus($DealerHandTotal, $UserHandTotalRight, $StatusBar, 2)
                    EndIf
                    GUICtrlSetState($btn_hit, $GUI_DISABLE)
                    GUICtrlSetState($btn_hold, $GUI_DISABLE)
                    GUICtrlSetState($btn_deal, $GUI_ENABLE)
                    $is_split = 0
                EndIf

- EDIT changed tags

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

I founded a bug i got 21 as a start and pressed hold and the comp got 22 and won ? how is that possible

Attached a pic to show u the bug


My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

Share this post


Link to post
Share on other sites

Both bugs should be fixed (one if statement should fix both problems, no sleep)

see 1st post for download


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

lol ^

Two things, the bottom left corner where it displays what the dealer has does not get cleared after every hand. It always shows what the dealer previously had last hand.

Also, i drew to the computer when I had BlackJack and the computer had a regular 21.

All in all, great job.

Edited by ame1011

[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

lol ^

Two things, the bottom left corner where it displays what the dealer has does not get cleared after every hand. It always shows what the dealer previously had last hand.

Also, i drew to the computer when I had BlackJack and the computer had a regular 21.

1st problem is easy to fix, currently don't have blackjack programmed in as a win

Maybe add that to todo list

put the following code, 1st line after the $btn_deal

_GUICtrlStatusBarSetText($StatusBar, "", 0)
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Nice and compact Gary, I expected it to be much larger from our conversations. I still think you should change "Draw" to "Push" :lmao:


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Nice and compact Gary, I expected it to be much larger from our conversations. I still think you should change "Draw" to "Push" :lmao:

If I add the betting in I'll make sure to change that.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

One thing I noticed in your code, unless you meant it to be this way...is that the dealer holds on 16, when usually dealers hold on 17 or higher...

other than that it looks good, I had actually just started to make a blackjack game earlier in the week but got sidetracked.

Share this post


Link to post
Share on other sites

One thing I noticed in your code, unless you meant it to be this way...is that the dealer holds on 16, when usually dealers hold on 17 or higher...

other than that it looks good, I had actually just started to make a blackjack game earlier in the week but got sidetracked.

I haven't worked in the rule for Hard 16 hand and Soft 17 hand yet.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0