Re: Who's up for a little game?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Re

hunter = {rand(20), 5}     --{current_room, arrows}  
wumpus = {rand(20), 0}     --{current_room, asleep or awake}  
pits = {rand(20), rand(20)}  
bats = {rand(20), rand(20)}  
  
--check hunter doesn't start in room with a wumpus, pits or bats  
while 1 label "crossover" do  
     if hunter[ROOM] = wumpus[ROOM] then  
        wumpus[ROOM] = rand(20)  
        continue  
     end if  
       
     for i = 1 to 2 do  
        if hunter[ROOM] = pits[i] then  
              pits[i] = rand(20)  
              continue  
        end if  
        if hunter[ROOM] = bats[i] then  
              bats[i] = rand(20)  
              continue  
        end if  
        if wumpus[ROOM] = bats[i] then  
              bats[i] = rand(20)  
              continue  
        end if  
        if wumpus[ROOM] = pits[i] then  
              pits[i] = rand(20)  
              continue  
        end if  
        for j = 1 to 2 do  
              if bats[i] = pits[j] then  
                    pits[j] = rand(20)  
                    continue "crossover"  
              end if  
        end for  
     end for  
     exit  
end while  

This is cleaner:

  sequence status = {0,0,0,0,0,0} 
  procedure mkStatusList()  
    sequence list = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20} 
    integer r 
    for i = 1 to 6 do 
      r = rand_range(i,20) -- select a number between i and 20 inclusive 
      status[i] = list[r]  -- copy the value to status 
      list[r] = list[i]    -- removing list[r] from the list 
    end for   
  end procedure 

Being object-like is not really in the spirit of the game

Using functions to get values is perhaps useful:

(and the original did use functions)

  eg: function bat_nearby(integer room) 
        return find(status[bat1],caves[room]) or 
             find(status[bat2],caves[room]) 
      end function 
 
  or: procedure move_item(integer item, integer room) 
        -- assert(find(item,{HUNTER,WUMPUS}),"fixed item") 
        status[item] = room 
      end procedure 

Re arrows:

I think they could be a 7th status item making them consistent with the other items in the game.

Finally:

By my reading of the game..

The wumpus wakes if you fire an arrow or you enter his room. He then moves or doesn't move and eats you if you are in the room.

There is no test to see if he is awake or not so the only inference I can make is he then goes back to sleep. Therefore, the asleep or awake status flag is not needed.

A riskless winning strategy is easy to find if you know the set-up of the rooms. Allowing him to stay awake makes it harder only if you mess up the first time. After that you would only find him safely if he moved to a square next to you (3 in 19).

There is a good riskless strategy to follow even then.

It might be useful to change the rules slightly.

eg:

Give the rooms display numbers which are not the same as the play room numbers. This way a person cannot know the arrangement of rooms to fire arrows until he has been to adjacent rooms.

Allow the a probability of missing with an arrow. This should increase with distance.

One suggestion from the Wumpus2 page was to allow one-way tunnels.

Bill

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu