This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

matzaurus
matzaurus presents ...

2012/3/13

Black-Jack

Don't worry it's not like your playing with real money, and the bet feature is not implemented yet.

4900 views / 15 in the last 7 days

Tags: mouse game

Your browser does not support the canvas tag.
matzaurusmatzaurus

2012/3/13

First time using Greenfoot :). Let me know if you find any bugs or have any suggestions. And of course if you like it or not :D
danpostdanpost

2012/3/14

Would be nice to show dealers cards after 'Stand'ing. Also, would be more realistic if the same card did not keep showing up. Could create the full shuffled deck, removing used cards during play, until cards remaining is less than 12 or so, then remove all cards, and create a new shuffled deck.
sp33dysp33dy

2012/3/14

Would be nice to see the dealers cards, full stop; however, great look already! Think about having the cards float in from deck. Promising.
matzaurusmatzaurus

2012/3/14

Thanks for the feedback! I've solved the problem with the same cards showing up so often. It used to rebuild the deck at each new deal because if you ran out of cards from the deck while playing it would give a NullPointer Error but the new version will check every time you take an action if the deck is empty and refresh it. I still haven't figured out how to show the cards after the win/loose message and how to make them float :). I'll keep working on it ... If anyone has any ideas about those two things and wishes to share them with me leave a comment :).
A new version of this scenario was uploaded on Wed Mar 14 14:13:15 UTC 2012 Fixed the deck refreshing at each new deal so you don't get the same cards as often.
sp33dysp33dy

2012/3/14

The card deck should remain constant (as per a real deck); look into holding in an array. In fact, several packs could be used. In this way, card counting 'could' be used as a tactic. If I keep hitting, I should see Lose come up if I go over 21. Not happening at the moemnt.
matzaurusmatzaurus

2012/3/14

Well the deck doesn't have to remain constant considering a real game of blackjack is played with multiple decks which get shuffled, I might just add more stacks :) cause thats what I used to implement the deck and pick cards randomly from them so in that case you can get the same card in a draw :D. Won't putting them in an array result in a ton of iterations through it even in an ArrayList?. I'll put a bustCheck in the Hit button so it busts you if you go over 21 while hitting rather that when you stand and let the dealer finish drawing his cards.
sp33dysp33dy

2012/3/14

If you used an array list though, you can deal from the top. After a hand, randomly add the cards in play to the end of the array. In that way, the cards remain constant. Every now and again you could shuffle up the entire pack. Just a thought. You don't need to loop or iterate through the array list because you just want to use a FIFO (first in first out) array. Does that make sense?
matzaurusmatzaurus

2012/3/14

Yep! The ArrayList would be good. Now I got my head around it :) thanks!
jeanjean

2012/5/23

Can you share your source code?

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.