|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
formula for deck of cards
OK. i have a deck of cards thing. numbers 1-52. this is a problem that i have to solve, yes if it were me i wouldnt use just numbers.
here's the numbers and what they need to come out to after the formula x->y 5->13 19->10 52->2 34->6 13->11 8->13 23->9 40->5 3->1 11->13 here's the current formula. which works with some but not with all. i have to find a new formula or a way to do it that works on all. I suck at math hoping somebody much smarter than myself could help me out. y = (14 - intval (( x ) / 4)) thank you |
|
#2
|
||||
|
||||
|
RE: formula for deck of cards
Can you be more specific about what you're trying to do?
It kind of looks like you're trying to convert 1-52 into 1-13 (value of the card without suit). I'm not sure I understand your mapping though. I would simply use y = ((x-1) % 13)+1. That will map 1-13 into 1-13, 14-26 into 1-13, 27-39 into 1-13, and 40-52 into 1-13. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Programming Theory > formula for deck of cards |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|