I have just created my first ruby program and I would like some feedback on it. I am very excited about learning this new language and have come to learn many things about it these last couple of days. I am coming from a basic/intermediate level C++ and C# background and I am just expanding my knowledge to learning other languages. I am still fairly new at programming and I am doing as much as I can reading the wonderful resources by community experts here. Please let me know how I can improve this small Rock, Paper, Scissor Program further to achieve a more readable and possible standard approach using the ruby way. I would like to further minimize the amount of lines in this program and use best practices that I haven't yet learned. Please hit me with all of your knowledge and feel free to ridicule me about the code if required. Thank You.
class Game def initialize # Calling the introduction method introduction if playGame # Calling the playerChoices method playerChoices print "\nChoose one Player 1: " @player1_Choice = gets.chomp playerChoices print "\nChoose one Player 2: " @player2_Choice = gets.chomp # Calculating the game results method gameResult else print "very well, next time then." end end def introduction print "Welcome to a game of Rock, Paper and Scissors!\n" end def playerChoices print "\nPlease choose your destiny!\n" print "1.Rock\n2.Paper\n3.Scissors\n" end def playGame print "Would you like to play a game? Y/N : " @play = gets.chomp.upcase if @play == "Y" return true else return false end end def gameResult print "\nOkay the winner of the game is: \n" player1 = @player1_Choice player2 = @player2_Choice if player1 > player2 print "Player 1 Wins!!!" elsif player1 < player2 print "Player 2 Wins!!!" else print "It is a TIE!!!" end end end