Continous Integration in der Praxis Gruppenarbeit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.0 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace MiniGames.Shared.Models
  7. {
  8. public class TicTacToeBrett
  9. {
  10. int[,] Felder;
  11. public TicTacToeBrett()
  12. {
  13. Felder = new[,]
  14. {
  15. { -1, -1, -1 },
  16. { -1, -1, -1 },
  17. { -1, -1, -1 },
  18. };
  19. }
  20. public TicTacToeBrett(int[,] felder)
  21. {
  22. Felder = felder;
  23. }
  24. public bool Gleich(TicTacToeBrett anderes)
  25. {
  26. for (int i = 0; i < 3; i++)
  27. {
  28. for (int j = 0; j < 3; j++)
  29. {
  30. if (Felder[i, j] != anderes.Felder[i, j])
  31. {
  32. return false;
  33. }
  34. }
  35. }
  36. return true;
  37. }
  38. public bool Set(int pos, int wert)
  39. {
  40. Felder[pos / 3, pos % 3] = wert;
  41. return true;
  42. }
  43. }
  44. }