Harbinger Update

Published June 19, 2007
Advertisement
Um... Not much to update on actually. I got sidetracked on a more basic project.. the infamous card deck. <_< I never really got much experience with objects when I first started using them, so I thought I'd follow in the steps of a few other people I've seen around GDnet and make a card game. So, on the the update there.

Vector iterators stink. If you have two, and you erase at one of them, the other one gets invalidated! -_- I was trying to make a sort for my deck - using my own home-made algorithm - but I kept getting mysterious "iterator out of range" runetime exceptions. Debugging brought me to my deck.erase statement - or at least the area around there. Meh. At least I learned a bit about , cause I'm using std::sort from there instead.

That leads me into the next update-rant. For some freakish reason, std::sort won't accept list begin() and end() iterators. I honestly don't know why, but when I tried to switch to a list - you know.. to see if I could solve my original invalid iterators problem - it threw THAT at me. UGH!

But, all is well. I'm still using a vector, and I'm sticking with std::sort... pity about my algorithm. I've got card types and suits set up, a constructor that lets you specify whether to have jokers or not, a DeckSize() function for the current size of the deck (excluding drawn cards), a TotalSize() function (it gives you the entire decksize, including drawn cards, which aren't actually removed from the vector), and Sort() and Shuffle() functions (which automatically return the deck to its fully un-drawn state, where TotalSize() and DeckSize() would be the same).

I was originally planning on having CardDeck be able to act as a hand too, but it seems a bit too complex for one class, so I'll likely remove Sort() and use it for CardHand. After I finish that, I'll be making a basic War card game. :D

So, summary: War going well, Harbinger on hold.

P.S. Did I mention I got Apache, MediaWiki, mySQL, and PHP5 on my iPod?
Previous Entry Code::Blocks
Next Entry War!
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement