fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8. public class Minion
  9. {
  10. public static int manaCost;
  11. public static int attack;
  12. public static int health;
  13. public static string cardText;
  14. public Minion(int mana, int atk, int h, string txt)
  15. {
  16. manaCost = mana;
  17. attack = atk;
  18. health = h;
  19. cardText = txt;
  20. }
  21. public void displayStats(string name)
  22. {
  23. Console.WriteLine(name + "\nMana Cost: " + manaCost + "\nAttack: " + attack + "\nHealth: " + health + "\n" + cardText + "\n");
  24. }
  25. }
  26. class Program
  27. {
  28. static void Main(string[] args)
  29. {
  30. List<string> indexList = new List<string>();
  31. Dictionary<string, Minion> minionList = new Dictionary<string, Minion>();
  32.  
  33. //buffer so I start at 1 and not 0
  34. indexList.Add("MissingNo");
  35.  
  36. //make a Wolfrider card
  37. indexList.Add("Wolfrider");
  38. Minion Wolfrider = new Minion(3, 3, 1, "Charge");
  39. minionList.Add(indexList[1], Wolfrider);
  40.  
  41. //make a Goldshire Footman card
  42. indexList.Add("Goldshire Footman");
  43. Minion GoldshireFootman = new Minion(1, 1, 2, "Taunt");
  44. minionList.Add(indexList[2], GoldshireFootman);
  45.  
  46. //look through all my cards
  47. for (int i = 1; i < indexList.Count(); i++)
  48. minionList[indexList[i]].displayStats(indexList[i]);
  49. Console.ReadLine();
  50. }
  51. }
  52. }
Success #stdin #stdout 0.05s 24040KB
stdin
Standard input is empty
stdout
Wolfrider
Mana Cost: 1
Attack: 1
Health: 2
Taunt

Goldshire Footman
Mana Cost: 1
Attack: 1
Health: 2
Taunt