Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. }
  2. class Program
  3. {
  4. public static bool NextStep(string[,] GameArray, string p, int sor, int oszlop)
  5. {
  6. if (sor >= 0 && sor < 3 && oszlop >= 0 && oszlop < 3)
  7. {
  8. //if(kijon fv-t meghívni
  9.  
  10. if (GameArray[sor, oszlop] == null)
  11. {
  12. GameArray[sor, oszlop] = p;
  13. return true;
  14. }
  15. return false;
  16.  
  17. }
  18. return false;
  19.  
  20. }
  21. static void Main(string[] args)
  22. {
  23. string[,] GameArray = new string[3, 3];
  24. NextStep(GameArray, "X", 0, 0);
  25. NextStep(GameArray, "O", 0, 1);
  26. NextStep(GameArray, "X", 1, 0);
  27. NextStep(GameArray, "O", 1, 1);
  28. foreach (var item in GameArray)
  29. {
  30. Console.WriteLine(item);
  31. }
  32. Console.ReadLine();
  33.  
  34.  
  35.  
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement