Inform 7: West of White House mapping woes

(chuckling) This isn’t as easy as it looks.

Here’s the map I’m trying to implement in Inform 7 (source code will follow):
West 02 Map.jpg

Here’s what the map looks like in the Inform 7 index:
West 02 Map Exported.jpg

And finally here’s the Inform 7 source code:

“West of House 02” by Jay Goemmer

When play begins: say “Introductory text.”

This Place [West] is a room. This Place is west of This Place 4. [North] The printed name is “West of White House”.
This Place 2 [South] is south of This Place. [West] The printed name is “South of White House”.
This Place 3 [East] is east of This Place 2. [South] The printed name is “East of White House”.
This Place 4 [North] is north of This Place 3. [East] The printed name is “North of White House”.
This Place 3 [East] is east of This Place 4. [North] This Place 2 [South] is south of This Place 3. [East] This Place [West] is west of This Place 2. [South] This Place 4 [North] is north of This Place. [West]

From the beginning, the player can move around the circle counterclockwise S, E, N, W, and arrive back at the starting point. From there, they can also circle clockwise N, E, S, W. Both of those are fine, and I managed to successfully implement those.

However, I also ended up with some unwanted connections. When I’m West, I can go east and end up North; when I’m North, I can go south and end up East. The fun continues thusly: When I’m East, I can go west and end up South, and when I’m South, I can go north and end up West.

Like I said, this isn’t as easy as it looks. Also, I’m using Inform 7 build 6G60 on a Windows 7 machine. And I wrote this source code just yesterday. A little help, here? :blush:

Thanks in advance! :smiley:

See section 3.3, “One-Way Connections”. You want:

This Place [West] is a room.
This Place 4 [North] is a room.

West of This Place 4 is north of This Place.

…and so on.

The Index map will never draw bent connections like this, though, so you’re not going to get that to look right.

Try this.

[code]“Test”

Definition: a direction is viable if the room it from the location of the player is a room.

After looking:
let count of exits be the number of viable directions;
say "From here you can go ";
if the count of exits is 0 begin;
say “nowhere”;
otherwise;
say list of viable directions;
end if;
say “.”.

The North of The White House is A Room. The South of The White House is A Room. The East of The White House is A Room. The West of The White House is A Room.

North of The East of The White House is east of The North of The White House.
North of The West of The White House is west of The North of The White House.
South of The East of The White House is east of The South of The White House.
South of The West of The White House is west of The South of The White House.
East of The North of The White House is north of The East of The White House.
East of The South of The White House is south of The East of The White House.
West of The North of The White House is north of The West of The White House.
West of The South of The White House is south of The West of The White House.

Index map with The North of The White House mapped northwest of The East of The White House.
Index map with The North of The White House mapped northeast of The West of The White House.
Index map with The South of The White House mapped southwest of The East of The White House.
Index map with The South of The White House mapped southeast of The West of The White House.
Index map with The East of The White House mapped southeast of The North of The White House.
Index map with The East of The White House mapped northeast of The South of The White House.
Index map with The West of The White House mapped southwest of The North of The White House.
Index map with The West of The White House mapped northwest of The South of The White House.

Test me with “e / s / w / n / w / s / e / n”.[/code]

Hope this helps.

“North of The East of The White House is east of The North of The White House” is a two-way connection. (Despite the title of that chapter.) So climbingstars’s example doesn’t need all eight of those lines – you can cut out the last four.

You can also cut out the last four “mapped” declarations; the first four are sufficient to define the map geometry.

zarf,
Thanks so much! I’ll use your approach to “nail things down!” :smiley:

Yeah, I was pretty sure that wasn’t possible. I just posted it in case it would offer some additional hints to this problem.

Thanks again, and cheers,

Here’s the now-functional revised source code: :wink:

[code]“West 03” by Jay Goemmer

When play begins: say “Introductory text.”

[Thanks to Andrew “zarf” Plotkin for help with laying out this part of the map.]

This Place [West] is a room. The printed name is “West of White House”.
This Place 2 [South] is a room. The printed name is “South of White House”.
This Place 3 [East] is a room. The printed name is “East of White House”.
This Place 4 [North] is a room. The printed name is “North of White House”.

West of This Place 4 is north of This Place.
West of This Place 2 is south of This Place.
East of This Place 2 is south of This Place 3.
East of This Place 4 is north of This Place 3.
[/code]

Thanks to also to climbingstars for the other code suggestion, as well! :smiley:

Cheers to everyone,

Ah, the illustrious “The!” --I missed that. :blush:

Thanks again for the insight! :slight_smile:

Cheers,

Very elegant solution that. I am just taking the first steps with I7 and didn’t know you could go “West of X is east of Y”.

But I tried my hand at this as an exercise, from a newbie point of view without the refinery.

Here’s my “brute force” approach, and it also works, as far as I can see:

[code]“Doodle” by Googler

When play begins: say “Introductory text.”

[Define the rooms. Copied from the example above]
This Place [West] is a room. The printed name is “West of White House”.
This Place 2 [South] is a room. The printed name is “South of White House”.
This Place 3 [East] is a room. The printed name is “East of White House”.
This Place 4 [North] is a room. The printed name is “North of White House”.

[Set up the clockwise path around the White House]
North of This Place [West] is This Place 4 [North].
East of This Place 4 [North] is This Place 3 [East].
South of This Place 3 [East] is This Place 2 [South].
West of This Place 2 [South] is This Place [West].

[Set up the anti-clockwise path around the White House]
South of This Place [West] is This Place 2 [South].
East of This Place 2 [South] is This Place 3 [East].
North of This Place 3 [East] is This Place 4 [North].
West of This Place 4 [North] is This Place [West].

[Remove unwanted directions]
East of This Place [West] is nothing. West of This Place [West] is nothing.
North of This Place 2 [South] is nothing. South of This Place 2 [South] is nothing.
East of This Place 3 [East] is nothing. West of This Place 3 [East] is nothing.
North of This Place 4 [North] is nothing. South of This Place 4 [North] is nothing.[/code]

Cheers

I sort of added the extra ones for clarity, symmetry, completeness and perfection. :smiley:

Well, we can’t argue with perfection, can we? :wink: :smiley:

Cheers,

Here’s another way to do it:

“West 03” by Jay Goemmer

When play begins: say “Introductory text.”

House is east of WestHouse, west of EastHouse,
north of SouthHouse, and south of NorthHouse.
the printed name is “House”.

NorthHouse is a room.
the printed name is “North of House”.

instead of going northeast from WestHouse:
now yourself is in NorthHouse.

SouthHouse is a room.
the printed name is “South of House”.

EastHouse is a room.
the printed name is “East of House”.

WestHouse is a room.
the printed name is “West of House”.
yourself is in WestHouse.

instead of going south when yourself is in NorthHouse:
if a random chance of 1 in 2 succeeds:
now yourself is in WestHouse;
otherwise:
now yourself is in EastHouse.

instead of going southeast when yourself is in NorthHouse:
now yourself is in EastHouse.

instead of going southwest when yourself is in NorthHouse:
now yourself is in EastHouse.

instead of going north when yourself is in EastHouse:
now yourself is in NorthHouse.

instead of going northwest when yourself is in EastHouse:
now yourself is in NorthHouse.

instead of going southwest when yourself is in EastHouse:
now yourself is in SouthHouse.

instead of going north when yourself is in WestHouse:
now yourself is in NorthHouse.

instead of going north when yourself is in SouthHouse:
if a random chance of 1 in 2 succeeds:
now yourself is in WestHouse;
otherwise:
now yourself is in EastHouse.

instead of going northeast when yourself is in SouthHouse:
now yourself is in EastHouse.

instead of going northwest when yourself is in SouthHouse:
now yourself is in WestHouse.

instead of going south when yourself is in WestHouse:
now yourself is in SouthHouse.

instead of going south when yourself is in EastHouse:
now yourself is in SouthHouse.

instead of going northeast when yourself is in WestHouse:
now yourself is in NorthHouse.

instead of going southeast when yourself is in WestHouse:
now yourself is in SouthHouse.

That could cause issues as the map connections aren’t actually defined.