intfiction.org

The Interactive Fiction Community Forum
It is currently Sat Feb 23, 2019 5:04 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Feb 03, 2019 11:24 pm 
Offline

Joined: Wed Aug 08, 2018 12:12 am
Posts: 7
Is there a way to use plural and singular words for each part of a multi number value? Eg. 1 hour 10 minutes, vs 2 hours 1 minute.
I have this code:
Code:
X is a room.
A height is a kind of value.
1 foot 11 inch (singular) specifies a height.
5 feet 11 inches (plural) specifies a height.
A person has a height.
The height of the player is 1 foot 1 inch.

But the showme output is:
Code:
height: 1 feet 1 inches

If I change the height to 0 foot 1 inch then the output is singular.

If I change the definition to:
Code:
1 foot 1 inch (singular) specifies a height.

Then it will still display:
Code:
height: 0 feet 3 inches

This is clearly wrong and I've defined a foot as being 2 inches.


If I change it to this:
Code:
X is a room.
A height is a kind of value.
1 foot (singular) 11 inch (singular) specifies a height.
5 feet (plural) 11 inches (plural) specifies a height.
A person has a height.
The height of the player is 1 foot 1 inch.


It errors, because the first (singular) is now part of the specification.

I tried to look at how time is defined in the standard rules but it seems to be on a lower level.
Is there a good way to do this that I haven't found, or do I need to build this up more manually? (Or just let the singular/plural forms be the same)


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Feb 04, 2019 8:45 am 
Offline

Joined: Sat Feb 13, 2016 6:26 pm
Posts: 168
Hmm, I tried several things (which I included in the code below, in square brackets) and I don't know why this happens.

Perhaps if you included Graham Nelson's extension "Metric Units" or "Approximate Metric Units?"

If you simply ignore singulars and plurals, the code compiles, as in:

Code:
X is a room. Lady Gaga is a woman in X.

A height is a kind of value.
[1 foot (singular) specifies a height.
2 feet (plural) specifies a height.
1 inch (singular) specifies a height scaled down by 12.
2 inches (plural) specifies a height scaled down by 12.]
5 feet 11 inches specifies a height.

A person has a height.

The height of Lady Gaga is 5 feet 2 inches.

After examining Gaga, say "She is [the height of Lady Gaga] tall."


This gives:

Quote:
>x gaga
You see nothing special about Lady Gaga.

She is 5 feet 2 inches tall.


But if I write:
Code:
The height of Lady Gaga is 5 feet 1 inch.

this does not compile.

On the other hand, if I write:
Code:
5 feet 1 inch specifies a height.
The height of Lady Gaga is 5 feet 1 inch.

this compiles, but gives a totally weird result:

Quote:
>x gaga
You see nothing special about Lady Gaga.

She is 0 feet 11 inches tall


By the way, I am a bit of a noob, so...


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Feb 04, 2019 11:34 am 
Offline

Joined: Mon Dec 15, 2014 9:15 am
Posts: 428
Your best bet is probably just to write your own rule for formatting heights. Something like this, maybe:
Code:
A height is a kind of value.
2 feet 11 inches specifies a height with parts feet and inches.

To say (L - a height) in feet and inches:
   let F be the feet part of L;
   let I be the inches part of L;
   say "[F] [if F is 1]foot[else]feet[end if] [I] [if I is 1]inch[else]inches[end if]".

After examining Gaga, say "She is [the height of Lady Gaga in feet and inches] tall."


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Feb 04, 2019 9:04 pm 
Offline

Joined: Wed Aug 08, 2018 12:12 am
Posts: 7
GiannisG wrote:
On the other hand, if I write:
Code:
5 feet 1 inch specifies a height.
The height of Lady Gaga is 5 feet 1 inch.

this compiles, but gives a totally weird result:

Quote:
>x gaga
You see nothing special about Lady Gaga.

She is 0 feet 11 inches tall



Yeah, I skimmed over that a bit but what I think happened here is:
Code:
5 feet 11 inches (plural) specifies a height.
1 foot 1 inch (singular) specifies a height.

When written in plural, 1 feet = 12 inches. But when written singularly, 1 foot = 2 inch.
I just tested, and even with single part values, using a 1 for the singular definition isn't necessary, so there's no reason this might theoretically help. "2 inch (singular) specifies a height." works fine, so this was a bit of a red herring.


jrb wrote:
Your best bet is probably just to write your own rule for formatting heights. Something like this, maybe:
Code:
A height is a kind of value.
2 feet 11 inches specifies a height with parts feet and inches.

To say (L - a height) in feet and inches:
   let F be the feet part of L;
   let I be the inches part of L;
   say "[F] [if F is 1]foot[else]feet[end if] [I] [if I is 1]inch[else]inches[end if]".

After examining Gaga, say "She is [the height of Lady Gaga in feet and inches] tall."

Yeah, that seems like the best solution if I7 won't do it itself, thanks!


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group