❔ Need help with a Tic Tac Toe project
im trying t ocreate a tic tac toe game and was wondering if it was possible to create a board where u can input your vaules
5 Replies
That would be tricky in a CLI app. I think you might be better off getting the user to enter the position of the next 'x' or 'o' they want to place
How do I do that?
take in the input from the user using Read, ReadLine or ReadKey depending on your implementation
then use TryParse to parse the input from the user, if you are looking to get the position you will need to use int.TryParse
if the parse is successful you can use the input as an index for your board array
it might be a good idea to do some checking to ensure the index is not out of bounds of the array as well so if your board is only for instance 9 tiles, you only want to accept a value between 0-8 (because arrays start at index 0)
you can check the bounds by checking board.Length
i dont get this part
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.