osiewicz / TicTacToe-C

Extended version of legendary game.
6 stars 8 forks source link

Add printing of field numbers. #9

Open axelf4 opened 7 years ago

axelf4 commented 7 years ago

Print the numbers of the fields at the start of each game. Instead of this:

#|#|#
#|#|#
#|#|#

print this:

1|2|3
4|5|6
7|8|9

This helps the user know how the fields are numbered.

osiewicz commented 7 years ago

Hey. This idea has popped up in my mind a few times but I'm not sure whether it deserves separate function. Take a look at this line - I've linked to your repo but it doesn't matter. We could do some fiddling with flags so that it would be possible to print i (which is field number, mind you) - it has an added benefit of enabling new view:

1 | X | O
4 | 5 | O
7 | 8 | X

What's your take on that?

axelf4 commented 7 years ago

In my opinion print_board would do too much if you added more functionality - however your example of the new view is kinda cool. The question, though, is how you would align the X:s and O:s;

 1| 2| 3| 4
 5|X| 7|O
 9|10|X|12
13|X|15|O

Do you always left-pad them with spaces or do you try to center them? All in all I think it could work, but that it would get ugly to have to pass a special flag to only print the field numbers at the start of each game. Your call. ;)

osiewicz commented 7 years ago

Settings struct has flag field anyways. It shouldn't be that cumbersome to implement, really. Your example is thought-provoking and it definitely needs further examination.
I'm not a fan of having two print functions when we have generalized print function in place.. I'll put it out there: all this functionality requires is to print current field index instead of ff_sign if a flag is set. Of course we'd like to have it show field numbers on game start (and that suggests fiddling with the flag if it's not set). Still, I believe that it could be done. The bigger problem (but not huge) is padding and how we approach it.