I am trying to build a deck of cards, but not regular playing cards, and I am having problems figuring out how to code it.
I built a class called "Cards" and a class called "BuildDeck"... I would like it to build the deck then shuffle it, then draw a card... but I don't know what kind of logic or method to go about this. I am new to c# so please bare with my idiocracy. I thought I figured it all out by assigning each method to a delegate array... but now I don't know how to call the individual array later....
I used "BuildDeck deck = new BuildDeck();" then tried to perform something like "deck.tileDeck[21];" and the code through a "Only assignment, call, increment, decrement, and new object expressions can be used as a statement." which i looked up and translated to the program saying "I don't get what you want me to do, this is a useless statement."
Any help?
| class Tiles |
| { |
| string RoadType; |
| string TileName; |
| |
| int BldgLifeTiles; |
| int BldgBulletTiles; |
| int BldgZombies; |
| int BldgSpaces; |
| int BlankSpaces; |
| int InvalidSpaces; |
| int RoadSpaces; |
| int nZombies; |
| |
| public Tiles() |
| { |
| RoadType = ""; |
| |
| TileName = ""; |
| |
| BldgLifeTiles = 0; |
| BldgBulletTiles = 0; |
| BldgZombies = 0; |
| BldgSpaces = 0; |
| BlankSpaces = 0; |
| InvalidSpaces = 0; |
| RoadSpaces = 0; |
| nZombies = 0; |
| } |
| |
| public void TownSquare() |
| { |
| RoadType = "Xroad"; |
| |
| TileName = "Town Square"; |
| |
| nZombies = 4; |
| |
| BldgLifeTiles = 0; |
| BldgBulletTiles = 0; |
| BldgSpaces = 0; |
| |
| BlankSpaces = 0; |
| InvalidSpaces = 4; |
| RoadSpaces = 5; |
| |
| // return TileName; |
| } |
| public void TRoad() |
| { |
| RoadType = "TRoad"; |
| |
| TileName = "T Road"; |
| |
| nZombies = 3; |
| |
| BldgLifeTiles = 0; |
| BldgBulletTiles = 0; |
| BldgSpaces = 0; |
| |
| BlankSpaces = 0; |
| InvalidSpaces = 5; |
| RoadSpaces = 4; |
| // return TileName; |
| } |
| } |
| class BuildDeck |
| { |
| public delegate void TileDelegate(); |
| |
| public TileDelegate[ tileDeck; |
| |
| public BuildDeck() |
| { |
| cardDeck = new CardDelegate[50]; |
| tileDeck = new TileDelegate[28]; |
| } |
| |
| public void BuildTileDeck(int i) |
| { |
| Tiles floorTiles = new Tiles(); |
| |
| |
| tileDeck[0] = floorTiles.ArmySurplusStore; |
| tileDeck[1] = floorTiles.DrugStore; |
| tileDeck[2] = floorTiles.FireStation; |
| tileDeck[3] = floorTiles.FloristShop; |
| tileDeck[4] = floorTiles.GasStation; |
| tileDeck[5] = floorTiles.HardwareStore; |
| tileDeck[6] = floorTiles.Hospital; |
| tileDeck[7] = floorTiles.LawnGardenStore; |
| tileDeck[8] = floorTiles.PoliceStation; |
| tileDeck[9] = floorTiles.SkateShop; |
| tileDeck[10] = floorTiles.SportingGoodsStore; |
| tileDeck[11] = floorTiles.ToyStore; |
| tileDeck[12] = floorTiles.Corner; |
| tileDeck[13] = floorTiles.Corner; |
| tileDeck[14] = floorTiles.Corner; |
| tileDeck[15] = floorTiles.Corner; |
| tileDeck[16] = floorTiles.Straight; |
| tileDeck[17] = floorTiles.Straight; |
| tileDeck[18] = floorTiles.Straight; |
| tileDeck[19] = floorTiles.Straight; |
| tileDeck[20] = floorTiles.TRoad; |
| tileDeck[21] = floorTiles.TRoad; |
| tileDeck[22] = floorTiles.TRoad; |
| tileDeck[23] = floorTiles.TRoad; |
| tileDeck[24] = floorTiles.XRoad; |
| tileDeck[25] = floorTiles.XRoad; |
| tileDeck[26] = floorTiles.XRoad; |
| tileDeck[27] = floorTiles.XRoad; |
| } |
| } |