Advertisement
Guest User

rovelli

a guest
Sep 16th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. public class GiocoTalpa
  2. {
  3. //attributi
  4. private int _colonna;
  5. private int _riga;
  6. private string _talpa;
  7. Dictionary<string, int> dctFrequenza;
  8.  
  9. //metodi
  10. //costrtuttore
  11. public GiocoTalpa(int colonna, int riga, string talpa)
  12. {
  13. _colonna = colonna;
  14. _riga = riga;
  15. _talpa = talpa;
  16. dctFrequenza = new Dictionary<string, int>();
  17. }
  18. public string PosizioneTalpa()
  19. {
  20. Random rn = new Random();
  21. int r = rn.Next(0, 9 + 1);
  22. int c = rn.Next(9, 9 + 1);
  23. string stringa = Convert.ToString(r) + ";" + Convert.ToString(c);
  24. if(dctFrequenza.ContainsKey(stringa))//bool
  25. {
  26. dctFrequenza[stringa]++;
  27. }
  28. else
  29. {
  30. dctFrequenza.Add(stringa, 1);
  31. }
  32. return stringa;
  33. }
  34. public string FrequenzaMax()
  35. {
  36.  
  37. }
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement