Maybe it's not exactly what you're looking for, but another option could be
using a BitVector.

You can find one in polygonal lab datastructures library, here:

http://lab.polygonal.de/ds/

A nice thing about it is that you don't need to care about the number of
bits you can use. Since the data is stored in an Array o ints, you can grow
it as much as you need, while keeping memory use as low as possible (at
least, in theory!). You can't check more than 1 bit at the time right now,
but if you need to, perhaps you could tweak the class to accept masks...

Some time ago I modified the BitVector class to use a ByteArray as its
backing storage (but preserving the API).

If you want to take a look, check out this link:

http://pastebin.be/22777


Cheers
Juan Pablo Califano

2010/1/4 Alexander Farber <[email protected]>

> Hello,
>
> I have programmed a card game and because
> the game type has 32 cards I made a decision
> to represent each card as a bit in a uint number.
>
> That decision has made many aspects easier
> for me: for example, checking if a player has
> any cards of some suit is simply an &-operation
> against a bit-mask.
>
> Now I'm thinking of programming another card
> games which use 36 or 52 playing cards and
> of course this won't work anymore...
>
> I wonder if 64-bit integers have been announced
> for the future versions of Flash and Flash Player?
>
> Regards
> Alex
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to