PDA

View Full Version : Solved: Shapes & Values



ndendrinos
08-23-2009, 01:32 PM
Q: is it possible to assign a value to a shape like this:
Picture 1255 = 5

or (if impossible) something like this
Picture 1255 = [A1].value

or any other way?

Working with pictures of playing cards what I'm trying to do is this:

If I have two cards (a two and a three) their respective values add to 5 in D1.

Searched Google with "assign value to shape ... no such thing.
Thank you

How about something like this:
With active shape
(If) (or multiple case) Picture.name 1255 then add 3 to D1 value



Now crossposted on: http://www.mrexcel.com/forum/showthread.php?p=2039043#post2039043

EDITED .......Thanks to MIKERICKSON at above link I have addressed the end result of this question.
The code will have 52 Case and I wonder if there is an easier way to go about it.
Thank you

mdmackillop
08-24-2009, 12:38 AM
I would consider renaning all cards to include the value as part of the name eg Pic01_01...Pic51_10, Pic52_10
You could then identify the card/value from the name.

Alternatively, assign Const values to variables to match the Card names within the code.

Bob Phillips
08-24-2009, 04:16 AM
I agree with MD in essence, although I would use the suit as part of the name, Pic_D_01, Pic_H_10, etc, and decode it to a value as and when needed.

mdmackillop
08-24-2009, 05:21 AM
I considered that, but then you have 10, J, Q, K to identify with equal value of 10, and with suits not being relevant to this game, I opted for the simplest names.

ndendrinos
08-24-2009, 05:50 AM
Thank you both and goodmorning , For once in six years I can say: I've done that already .... thought like xld at first and concluded like mdmackillop.
The game I'm working on is not to play blackjack with but rather to practice this card game.
Everytime a card is dealt the value of that card will increment in a cell and if the count passes 21 then another cell will announce "BUST"

So the sequel to this posting (I will start a new one w/attachment) is in regards to the Aces. Need them to count for 11 unless the count goes over 21 then 10 will have to be deducted from the count (thus reducing the value of the Ace to One ... good thing about working with shapes... in this scenario I could have 2 Aces ... one counting as 11 and the other as 1.

Then in the trilogy (final chapter) the hard part ... The correctness of the player's choice to Hit, Stand,Split or Double..... but that's another story.
Have a great day.

Bob Phillips
08-24-2009, 07:01 AM
I considered that, but then you have 10, J, Q, K to identify with equal value of 10, and with suits not being relevant to this game, I opted for the simplest names.
Hi MD,

I wouldn't use J, Q, K, A, just the suit and 1-13. I just feel the suit would be useful somewhere along the line, and would not require much manipulation.

ndendrinos
08-24-2009, 08:01 AM
You have a point ... that could be usefull for the next game "Poker" ...
A is tricky for in blackjack it counts for 11 as long as the combined total of the player's hand is under 21 otherwise it counts for just 1 thus keeping the hand from "busting"
I will start a new posting as soon as I put together an example.
New posting will be titled ... Shapes & Values ... the sequel
hope you have a look at it.
Thank you.