| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# $Id: NetHack.pm,v 1.8 2008/09/21 13:37:22 Martin Exp $ |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Lingua::Alphabet::Phonetic::NetHack - map ASCII characters to names of NetHack items |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
This is a specialization of L. |
|
11
|
|
|
|
|
|
|
You should not use this module directly; |
|
12
|
|
|
|
|
|
|
all interaction should be done with an object of type Lingua::Alphabet::Phonetic. |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $oSpeaker = new Lingua::Alphabet::Phonetic('NetHack'); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NOTES |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
The only ASCII characters which do not have NetHack names are comma and digits 1 through 9! |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
http://www.nethack.org |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 BUGS |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Please tell the author if you find any! |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 AUTHOR |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Martin Thurn (mthurn@cpan.org). |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 LICENSE |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
This software is released under the same license as Perl itself. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
##################################################################### |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
package Lingua::Alphabet::Phonetic::NetHack; |
|
41
|
|
|
|
|
|
|
|
|
42
|
2
|
|
|
2
|
|
42635
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
64
|
|
|
43
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
55
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
2
|
|
|
2
|
|
9
|
use base 'Lingua::Alphabet::Phonetic'; |
|
|
2
|
|
|
|
|
19
|
|
|
|
2
|
|
|
|
|
1442
|
|
|
46
|
|
|
|
|
|
|
our |
|
47
|
|
|
|
|
|
|
$VERSION = sprintf("%d.%02d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/o); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# First, the punctuation: |
|
50
|
|
|
|
|
|
|
my %hash = ( |
|
51
|
|
|
|
|
|
|
' ' => 'ghost', |
|
52
|
|
|
|
|
|
|
'!' => 'potion', |
|
53
|
|
|
|
|
|
|
'"' => 'amulet', |
|
54
|
|
|
|
|
|
|
'#' => 'corridor', |
|
55
|
|
|
|
|
|
|
'$' => 'gold', |
|
56
|
|
|
|
|
|
|
'%' => 'food', |
|
57
|
|
|
|
|
|
|
'&' => 'demon', |
|
58
|
|
|
|
|
|
|
"'" => 'golem', |
|
59
|
|
|
|
|
|
|
'(' => 'tool', |
|
60
|
|
|
|
|
|
|
')' => 'weapon', |
|
61
|
|
|
|
|
|
|
'*' => 'gem', |
|
62
|
|
|
|
|
|
|
'+' => 'door', |
|
63
|
|
|
|
|
|
|
# ',' => 'unused', |
|
64
|
|
|
|
|
|
|
'-' => 'wall', |
|
65
|
|
|
|
|
|
|
'.' => 'floor', |
|
66
|
|
|
|
|
|
|
'/' => 'wand', |
|
67
|
|
|
|
|
|
|
'0' => 'iron ball', |
|
68
|
|
|
|
|
|
|
# 1-9 here |
|
69
|
|
|
|
|
|
|
':' => 'lizard', |
|
70
|
|
|
|
|
|
|
';' => 'eel', |
|
71
|
|
|
|
|
|
|
'<' => 'staircase up', |
|
72
|
|
|
|
|
|
|
'=' => 'ring', |
|
73
|
|
|
|
|
|
|
'>' => 'staircase down', |
|
74
|
|
|
|
|
|
|
'?' => 'scroll', |
|
75
|
|
|
|
|
|
|
'@' => 'human', |
|
76
|
|
|
|
|
|
|
# A-Z here |
|
77
|
|
|
|
|
|
|
'[' => 'armor', |
|
78
|
|
|
|
|
|
|
'\\' => 'throne', |
|
79
|
|
|
|
|
|
|
']' => 'mimic', |
|
80
|
|
|
|
|
|
|
'^' => 'trap', |
|
81
|
|
|
|
|
|
|
'_' => 'altar', |
|
82
|
|
|
|
|
|
|
'`' => 'boulder', |
|
83
|
|
|
|
|
|
|
# a-z here |
|
84
|
|
|
|
|
|
|
'{' => 'fountain', |
|
85
|
|
|
|
|
|
|
'|' => 'grave', |
|
86
|
|
|
|
|
|
|
'}' => 'pool', |
|
87
|
|
|
|
|
|
|
'~' => 'tail', |
|
88
|
|
|
|
|
|
|
); |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
my @asLowercase = ( |
|
91
|
|
|
|
|
|
|
"ant", |
|
92
|
|
|
|
|
|
|
"blob", |
|
93
|
|
|
|
|
|
|
"cockatrice", |
|
94
|
|
|
|
|
|
|
"dog", |
|
95
|
|
|
|
|
|
|
"eye", |
|
96
|
|
|
|
|
|
|
"cat", |
|
97
|
|
|
|
|
|
|
"gremlin", |
|
98
|
|
|
|
|
|
|
"humanoid", |
|
99
|
|
|
|
|
|
|
"imp", |
|
100
|
|
|
|
|
|
|
"jelly", |
|
101
|
|
|
|
|
|
|
"kobold", |
|
102
|
|
|
|
|
|
|
"leprechaun", |
|
103
|
|
|
|
|
|
|
"mimic", |
|
104
|
|
|
|
|
|
|
"nymph", |
|
105
|
|
|
|
|
|
|
"orc", |
|
106
|
|
|
|
|
|
|
"piercer", |
|
107
|
|
|
|
|
|
|
"quadruped", |
|
108
|
|
|
|
|
|
|
"rodent", |
|
109
|
|
|
|
|
|
|
"spider", |
|
110
|
|
|
|
|
|
|
"trapper", |
|
111
|
|
|
|
|
|
|
"unicorn", |
|
112
|
|
|
|
|
|
|
"vortex", |
|
113
|
|
|
|
|
|
|
"worm", |
|
114
|
|
|
|
|
|
|
"xan", |
|
115
|
|
|
|
|
|
|
"light", |
|
116
|
|
|
|
|
|
|
"zruty", |
|
117
|
|
|
|
|
|
|
); |
|
118
|
|
|
|
|
|
|
my @asUppercase = ( |
|
119
|
|
|
|
|
|
|
"angel", |
|
120
|
|
|
|
|
|
|
"bat", |
|
121
|
|
|
|
|
|
|
"centaur", |
|
122
|
|
|
|
|
|
|
"dragon", |
|
123
|
|
|
|
|
|
|
"elemental", |
|
124
|
|
|
|
|
|
|
"fungus", |
|
125
|
|
|
|
|
|
|
"gnome", |
|
126
|
|
|
|
|
|
|
"giant", |
|
127
|
|
|
|
|
|
|
"invisible monster", |
|
128
|
|
|
|
|
|
|
"jabberwock", |
|
129
|
|
|
|
|
|
|
"Kop", |
|
130
|
|
|
|
|
|
|
"lich", |
|
131
|
|
|
|
|
|
|
"mummy", |
|
132
|
|
|
|
|
|
|
"naga", |
|
133
|
|
|
|
|
|
|
"ogre", |
|
134
|
|
|
|
|
|
|
"pudding", |
|
135
|
|
|
|
|
|
|
"quantum mechanic", |
|
136
|
|
|
|
|
|
|
"rust monster", |
|
137
|
|
|
|
|
|
|
"snake", |
|
138
|
|
|
|
|
|
|
"troll", |
|
139
|
|
|
|
|
|
|
"umber hulk", |
|
140
|
|
|
|
|
|
|
"vampire", |
|
141
|
|
|
|
|
|
|
"wraith", |
|
142
|
|
|
|
|
|
|
"xorn", |
|
143
|
|
|
|
|
|
|
"ape", |
|
144
|
|
|
|
|
|
|
"zombie", |
|
145
|
|
|
|
|
|
|
); |
|
146
|
|
|
|
|
|
|
map { $hash{$_} = shift @asLowercase } ('a'..'z'); |
|
147
|
|
|
|
|
|
|
map { $hash{$_} = shift @asUppercase } ('A'..'Z'); |
|
148
|
|
|
|
|
|
|
# Special cases / recover lost entries: |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub _name_of_letter |
|
151
|
|
|
|
|
|
|
{ |
|
152
|
26
|
|
|
26
|
|
2035
|
my $self = shift; |
|
153
|
26
|
|
|
|
|
26
|
my $s = shift; |
|
154
|
|
|
|
|
|
|
# print STDERR " + L::A::P::NetHack::_name_of_letter($s)\n"; |
|
155
|
|
|
|
|
|
|
# If we get more than one character, ignore the rest: |
|
156
|
26
|
|
|
|
|
31
|
my $c = substr($s, 0, 1); |
|
157
|
26
|
50
|
|
|
|
57
|
if (exists($hash{$c})) |
|
158
|
|
|
|
|
|
|
{ |
|
159
|
26
|
|
|
|
|
73
|
return $hash{$c}; |
|
160
|
|
|
|
|
|
|
} # if |
|
161
|
0
|
|
|
|
|
|
return $self->SUPER::_name_of_letter($s); |
|
162
|
|
|
|
|
|
|
} # _name_of_letter |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
1; |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
__END__ |