Changeset 165
- Timestamp:
- 11/01/04 18:24:07 (4 years ago)
- Location:
- branches/simplest-thing
- Files:
-
- 3 modified
-
acceptance/interface.tests.rb (modified) (6 diffs)
-
bin/faeriemud.rb (modified) (2 diffs)
-
lib/textui.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/simplest-thing/acceptance/interface.tests.rb
r164 r165 23 23 24 24 LOOK = "look" 25 SEE_WHAT = "You are locked in the formless void." 25 SEE_WHAT = %q[You are locked in the formless void with an ugly orc. He says, "Hi, I'm Punchbag".] 26 WHOAMI = "who am I?" 27 WHOAMME = "me?" 28 IAM = "You are %s." % NAME 26 29 OTHER = "meow" 27 OTHER_WHAT = "The formless void stares vacantly back at you. "30 OTHER_WHAT = "The formless void stares vacantly back at you. The orc's stare is more hungry than vacant." 28 31 29 32 QUIT = "quit" … … 56 59 if select([],[@io],[],1) 57 60 self.puts(NAME) 61 end 62 if select([],[@io],[],1) 63 self.puts(QUIT) 58 64 end 59 65 if select([@io],[],[],1) … … 73 79 `ruby bin/faeriemud.rb --reset` 74 80 end 81 75 82 end 76 83 … … 170 177 data += @game.gets until data.include?( PROMPT ) 171 178 172 # 2.4.0. I type 'look' and I receive back "You are locked in173 # the formless void with an ugly orc. He says, 'Hi, I'm174 # Punchbag '."179 # 2.4.0. I type 'look' and I receive back ``You are locked in 180 # the formless void with an ugly orc. He says, "Hi, I'm 181 # Punchbag".'' 175 182 assert_nothing_raised { @game.puts( LOOK ) } 176 183 assert @game.gets.include?( SEE_WHAT ) … … 181 188 # are <name>." for whatever name I chose when I created my 182 189 # character. 190 assert_nothing_raised { @game.puts( WHOAMI ) } 191 assert @game.gets.include?( IAM ) 192 assert @game.gets.include?( PROMPT ) 193 assert_nothing_raised { @game.puts( WHOAMME ) } 194 assert @game.gets.include?( IAM ) 195 assert @game.gets.include?( PROMPT ) 183 196 184 197 # 2.4.3. I type anything other than 'look', 'who am I?', 'me?' … … 188 201 assert_nothing_raised { @game.puts( OTHER ) } 189 202 assert @game.gets.include?( OTHER_WHAT ) 203 assert @game.gets.include?( PROMPT ) 190 204 191 205 # 2.4.2. I type 'quit' and I receive back: "Goodbye." The -
branches/simplest-thing/bin/faeriemud.rb
r164 r165 1 1 #!/usr/bin/env ruby 2 3 $defout.sync = true4 2 5 3 $: << File.join( File.dirname(File.dirname(__FILE__)), "lib") #:TODO: fix this 6 4 require "textui" 7 5 require "character" 6 8 7 require "optparse" 9 8 … … 48 47 end 49 48 50 message "FaerieMUD>" 51 49 playing = true 50 while playing 51 command = prompt( "FaerieMUD>" ) 52 case command 53 when "who am I?", "me?" #" 54 message "You are %s." % character.name 55 when "look" 56 message %q[You are locked in the formless void with an ugly orc. He says, "Hi, I'm Punchbag".] 57 when "quit" 58 message "Goodbye." 59 playing = false 60 else 61 message "The formless void stares vacantly back at you. The orc's stare is more hungry than vacant." 62 end 63 end -
branches/simplest-thing/lib/textui.rb
r163 r165 1 1 #!/usr/bin/env ruby 2 3 $defout.sync = true 2 4 3 5 module TextUI
