LogFAQs > #951575150

LurkerFAQs, Active DB, DB1, DB2, DB3, DB4, DB5, DB6, DB7, Database 8 ( 02.18.2021-09-28-2021 ), DB9, DB10, DB11, DB12, Clear
Topic List
Page List: 1
TopicDoes anyone want to code review a tic tac toe game I wrote in Ruby?
CoorsLight
03/10/21 7:48:50 PM
#10:


Just at a high level, first thing that jumped out to me is how many functions explicitly take in a board. I would probably have that board be something higher level so you don't have to pass it in over and over, I don't think that gives you any advantages since you won't have multiple different possible boards in a game. Not sure the best way that would look since I'm not a Ruby guy but I'm thinking maybe the board and the game logic could be separate classes.

There are a few functions I find overly granular, like input_to_index. I don't know exactly what to_i is but that function looks to basically just do subtraction, I don't think it's justified to have functions doing a single basic arithmetic step. Some of the other one-liners are kinda borderline too, that's just one example. position_taken is only called within one other function, why not have its implementation coded directly into the function that calls it? I'm also not sure how you could get to an empty string state there, looks like it initializes the board as a space.

Great now I feel like I'm being the nitpicky person here
... Copied to Clipboard!
Topic List
Page List: 1