How's this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
5th Jun 2017, 8:35 PM
Talha Mehtab
Talha Mehtab - avatar
2 Answers
0
Positives: Nice use of coordinates but the is a way to make it better, you will see later. Overall, it's a nice that you made this game. Suggestions: First of all, don't use SoloLearn's compilers for inputs and whole games because this is an online compiler so it doesn't work like you expect. Second, I recommend using 2D arrays to be able to set x/o for any square in the grid with ease. Third, you copy pasted the same code many many times instead of using for loops and checking what is where. You could have cut down the time needed to create this program by half if not more. Fourth, use Try-Catch statements. I could enter a character or a string of text and it would crash the program. And finally, I'm not sure what you are doing before the main() function there? As far as I've googled, I'm pretty sure the program should crash since you cannot "call" functions outside there. In fact, even if you could, that would make it harder to understand, as proven by me getting confused a bit.
27th Jun 2017, 10:29 AM
nedas
nedas - avatar
0
@nedas before main function I’ve just define Prototype of the Functions and declared them after main! And declared my variables globally so all functions access them easily!
18th Nov 2017, 5:03 PM
Talha Mehtab
Talha Mehtab - avatar