For one of my project, I have used this kind of logging Hoping this would help you
$FILE_LOG = Logging.create_log(File.expand_path('LoggingFile.log'), Logger::DEBUG)
def self.create_log(output_location level)
log = Logger.new(output_location, 'weekly').tap do |l|
next unless l
l.level = level
l.progname = File....
Don't think your question belongs to this code review section. You would have gotten help much faster if had posted in stackoverflow instead. Anyway there are couple points you need to check.
The CreateComments migration must have been updated (or at least there was another migration that changed the table) because the migration does not say anything about ...
I am not a professional game developer, just trying to help you base on my experience with Ruby so far. Glad to see your willingness of coding correctly from the beginning.
Some points to improve:
1.Move the bot names and game mode options to CONSTANTS
2.Prompting for user's input is duplicated many times, you should make a function that take prompting ...
The biggest thing that will allow the code to clean up a fair bit is if you had made a subclass of Player for AIPlayer:
class AIPlayer < Player
NAMES = ['Bob', 'Joseph', 'Catherine', 'Paul', 'Tom', 'Baker']
that will allow you to add a method get_weapon to Player, which would ask for the user input ...
I doubt if all those logic is meant to be in the ApplicationHelper. You could create a new helper file and move that logic.
As you have three constant values declared within the method body, you can move them outside as constants, and modify the value of total_stars depending on the conditions you have:
ZERO_STAR_ICON_NAME = "star"
FULL_STAR_ICON_NAME = "...
You can make use of the Array.new, passing in the maximum number of stars you want to show, and defaulting all the stars to empty. Then, you can fill in the number of full stars you need. Then, finally, thanks to Numeric's divmod returning either 0 or 1 for the number of half stars you need, you make one more pass and fill in the number of half stars you ...