Changeset 165

Show
Ignore:
Timestamp:
11/01/04 18:24:07 (4 years ago)
Author:
stillflame
Message:

- almost all acceptance tests pass now

Location:
branches/simplest-thing
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/simplest-thing/acceptance/interface.tests.rb

    r164 r165  
    2323 
    2424LOOK        = "look" 
    25 SEE_WHAT    = "You are locked in the formless void." 
     25SEE_WHAT    = %q[You are locked in the formless void with an ugly orc.  He says, "Hi, I'm Punchbag".] 
     26WHOAMI      = "who am I?" 
     27WHOAMME     = "me?" 
     28IAM         = "You are %s." % NAME 
    2629OTHER       = "meow" 
    27 OTHER_WHAT  = "The formless void stares vacantly back at you." 
     30OTHER_WHAT  = "The formless void stares vacantly back at you.  The orc's stare is more hungry than vacant." 
    2831 
    2932QUIT        = "quit" 
     
    5659        if select([],[@io],[],1) 
    5760            self.puts(NAME) 
     61        end 
     62        if select([],[@io],[],1) 
     63            self.puts(QUIT) 
    5864        end 
    5965        if select([@io],[],[],1) 
     
    7379        `ruby bin/faeriemud.rb --reset` 
    7480    end 
     81 
    7582end 
    7683 
     
    170177        data += @game.gets until data.include?( PROMPT ) 
    171178 
    172         # 2.4.0. I type 'look' and I receive back "You are locked in 
    173         # the formless void with an ugly orc.  He says, 'Hi, I'm 
    174         # 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".'' 
    175182        assert_nothing_raised           { @game.puts( LOOK ) } 
    176183        assert                          @game.gets.include?( SEE_WHAT ) 
     
    181188        # are <name>." for whatever name I chose when I created my 
    182189        # 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 ) 
    183196 
    184197        # 2.4.3. I type anything other than 'look', 'who am I?', 'me?' 
     
    188201        assert_nothing_raised           { @game.puts( OTHER ) } 
    189202        assert                          @game.gets.include?( OTHER_WHAT ) 
     203        assert                          @game.gets.include?( PROMPT ) 
    190204 
    191205        # 2.4.2. I type 'quit' and I receive back: "Goodbye."  The 
  • branches/simplest-thing/bin/faeriemud.rb

    r164 r165  
    11#!/usr/bin/env ruby 
    2  
    3 $defout.sync = true 
    42 
    53$: << File.join( File.dirname(File.dirname(__FILE__)), "lib") #:TODO: fix this 
    64require "textui" 
    75require "character" 
     6 
    87require "optparse" 
    98 
     
    4847end 
    4948 
    50 message "FaerieMUD>" 
    51  
     49playing = true 
     50while 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 
     63end 
  • branches/simplest-thing/lib/textui.rb

    r163 r165  
    11#!/usr/bin/env ruby 
     2 
     3$defout.sync = true 
    24 
    35module TextUI