Showing posts with label Gaming. Show all posts
Showing posts with label Gaming. Show all posts

Saturday, October 11, 2008

A deck of cards in OO Development.

I've been thinking about this for some time. I wanted to write a web based game that uses cards. Kind of think Monoploy or Poker or Solitare. My train of thinking is how do you treat cards.

A card is simple. It's just an object with some properties. In a poker deck a Jack of clubs has a graphic. You know the picture of the jack. It has a Value a J. Now in the deck you know there is only one Jack of Clubs. So my first problem is how do I track the cards that arent in the deck.

I simply started by thinking 2 Collections. A Deck Collection with all the cards and a discard stack. So if one card is pulled from the top of the deck that card has to be placed in to the discard stack. So with this bit of design i can pull a card off the top of a unshuffled deck and place it in a discard pile.

To shuffle I can create a random number generator. And then just delete from where it's pointed from the deck collection. This will then add on top of the discard pile. Now this allows us to pick the top card of a shuffled deck and place it ontop of a discard file.

Next I want to give the cards to players. Again with the 2 Collections one for the deck and one for the discard. The program needs to track where the card is. So all the player obects have collections for cards in there hand. Also a limiting INT to limit hand size. Cards are drawn with random number from the first collection and either placed in discard or hand of a player. then the player can be quiered for there hands.

Ok that's an over view of how to deal a poker hand. Then we can add testing and how to pull the cards and game play options like betting net. I'll post some code so I can test that.

Sunday, June 29, 2008

Acer TravelMate C300 update

I've done a little bit of mods to this humble machine. It had a purpose when I bought it. This is the gaming machine and the photography view machine. This is the lugabout when I wanted something that wasn't my 17 inch dual core laptop.

I'm into roleplaying games and wargames and I have alot of pdf's Orginally I thought well a double-sided Dvd full of PDF's is like 10 GIGs of stuff(roughly). A tablet is a good thing to read this on. I can lay it flat and search it faster then a book. I can flip it around and show ppl the pretty pics from the books or maps from adventures. Then I saw it an advertisement from micro center. The hard drive was dirt cheap less then 100 bucks for 250GB. Guess what memory transplant. Removed the old hard drive reloaded my OS with the factory restore discs added my software and I'm off. CC2 for giggles and bang.

Ok ok it's also surpose to carry my photos when I'm out shooting a model or something. Lighter then my 17 inch laptop. Fits well in most camera bags. After using CC2 on it with the tablet I feel in love and I may even add another blog for gaming stuff(that's another story). Memory upgrade to 2GIGs hit. Went to Geeks.com and got my chips they came I seated them. Ooh what did this have to do with using CC2. I added all my canon and freeware image stuff to it and now I got GIMPshop and stuff running there so I can manipulate photos on the tablet. Sweet.

So that's what I did to the thing.