Hey all,
I'm running into some trouble in debugging my playing card / deck creation code. I'm sure I'm missing something simple here, and I'd love it if someone can point it out.
I'm trying to create a card and add it to the DeckList, then prove that it exists via the debug output. The code compiles, but when I run it, it looks like variable s is still set to null. I'm not sure if the problem lies in my attempt to add the card to the list, or in my attempt to log the outcome.
Thanks!
I'm running into some trouble in debugging my playing card / deck creation code. I'm sure I'm missing something simple here, and I'd love it if someone can point it out.
I'm trying to create a card and add it to the DeckList, then prove that it exists via the debug output. The code compiles, but when I run it, it looks like variable s is still set to null. I'm not sure if the problem lies in my attempt to add the card to the list, or in my attempt to log the outcome.
Thanks!
Type TCard 'type defining a card Const SPADES = 1 Const HEARTS = 2 Const CLUBS = 3 Const DIAMONDS = 4 Field Suit:Int Field Rank:Int End Type Type TDeck '----FIELDS & VARS------ Field DeckList:TList '----METHODS----- Method Create() 'creates the card deck and sets the cards If Not DeckList Then DeckList = CreateList() For Local x:Int = 1 To 13 For Local y:Int = 1 To 4 Local Card:TCard = New TCard DebugLog("New Card Created") Card.Rank = x Card.Suit = y DebugLog("New Card's X and y set to: " + x + "," + y) DeckList.AddLast(Card) Local s:String = String(DeckList.Last()) DebugLog("Object added to list: " + s) Next Next End Method End Type Local GameDeck:TDeck = New TDeck GameDeck.Create()