Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #4113

Re: Lets play a guessing game. (how to code this better?)

From Super Goat <ruby-forum@sgoat.33mail.com>
Newsgroups comp.lang.ruby
Subject Re: Lets play a guessing game. (how to code this better?)
Date 2011-05-08 00:08 -0500
Organization Service de news de lacave.net
Message-ID <300d3c20c6331d56a96f4ec2018510c7@ruby-forum.com> (permalink)
References <60cd2d7685f4d805fa7b7b953b5667d5@ruby-forum.com>

Show all headers | View raw


Thanks again for everyones input and thanks to Jesus for explaining and 
providing examples for using a method in my code.

>And now, the OP is frightenend of functional programming
No, this sounds like fun.  I'll work my way there eventually.

So attached is my updated version.

As you can see I also added a # of 'guesses' variable that counts the 
number of attempts and then exits when you hit the max.  That took me a 
little while to figure out, but I am pleased that I got it.

I was thinking of asking if the player would like to play again and then 
figuring out how to restart the whole thing but I wasn't sure how to do 
this. How can I make prompt to "Play again?" and when answered "Yes" 
restart, whether the person wins or loses (or if "No" just exits)?  Or 
is the way my code is written make this impossible?

Attachments:
http://www.ruby-forum.com/attachment/6181/meth_100guess.rb


-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Lets play a guessing game. (how to code this better?) Super Goat <ruby-forum@sgoat.33mail.com> - 2011-05-05 01:45 -0500
  Re: Lets play a guessing game. (how to code this better?) Stu <stu@rubyprogrammer.net> - 2011-05-05 02:28 -0500
  Re: Lets play a guessing game. (how to code this better?) Josh Cheek <josh.cheek@gmail.com> - 2011-05-05 02:51 -0500
  Re: Lets play a guessing game. (how to code this better?) John Feminella <johnf@bitsbuilder.com> - 2011-05-05 03:10 -0500
    Re: Lets play a guessing game. (how to code this better?) Johannes Held <johannes.held@informatik.uni-erlangen.de> - 2011-05-06 10:51 +0200
      Re: Lets play a guessing game. (how to code this better?) Johnny Morrice <spoon@killersmurf.com> - 2011-05-06 07:01 -0500
        Re: Lets play a guessing game. (how to code this better?) Johnny Morrice <spoon@killersmurf.com> - 2011-05-06 07:04 -0500
        Re: Lets play a guessing game. (how to code this better?) Johannes Held <johannes.held@informatik.uni-erlangen.de> - 2011-05-06 14:13 +0200
          Re: Lets play a guessing game. (how to code this better?) Johnny Morrice <spoon@killersmurf.com> - 2011-05-06 07:23 -0500
  Re: Lets play a guessing game. (how to code this better?) Jesús Gabriel y Galán <jgabrielygalan@gmail.com> - 2011-05-05 03:56 -0500
  Re: Lets play a guessing game. (how to code this better?) Martin Boese <boesemar@gmx.de> - 2011-05-05 10:32 -0500
  Re: Lets play a guessing game. (how to code this better?) Super Goat <ruby-forum@sgoat.33mail.com> - 2011-05-06 01:18 -0500
    Re: Lets play a guessing game. (how to code this better?) Jesús Gabriel y Galán <jgabrielygalan@gmail.com> - 2011-05-06 02:27 -0500
    Re: Lets play a guessing game. (how to code this better?) Josh Cheek <josh.cheek@gmail.com> - 2011-05-06 02:34 -0500
  Re: Lets play a guessing game. (how to code this better?) Super Goat <ruby-forum@sgoat.33mail.com> - 2011-05-08 00:08 -0500
    Re: Lets play a guessing game. (how to code this better?) Josh Cheek <josh.cheek@gmail.com> - 2011-05-08 00:30 -0500
    Re: Lets play a guessing game. (how to code this better?) Stu <stu@rubyprogrammer.net> - 2011-05-08 01:16 -0500
      Re: Lets play a guessing game. (how to code this better?) Stu <stu@rubyprogrammer.net> - 2011-05-08 02:22 -0500
        Re: Lets play a guessing game. (how to code this better?) Super Goat <ruby-forum@sgoat.33mail.com> - 2011-05-08 21:20 -0500
          Re: Lets play a guessing game. (how to code this better?) Stu <stu@rubyprogrammer.net> - 2011-05-09 00:29 -0500

csiph-web