Skip to content

Commit 5296582

Browse files
committed
Partial fix for wizward.pl
this cannot have worked for a looong time. There were type constraints that had no chance of ever working, so it must be from a type before we enforced attribute type checks.
1 parent 6bbe840 commit 5296582

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

categories/games/wizard.pl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@
1313
multi wiz-prompt (Str $prompt, @options = ()) {
1414
my $choice;
1515
for (@options.kv) -> $key, $item {
16-
$item.key //= $key;
16+
$item.key //= ~$key;
1717
}
1818

1919
until (defined $choice && $choice ~~ any(@options.map: {.key})) {
20-
say $prompt;
2120
for @options -> $value {
2221
say "\t", $value.key, "\t", $value.text;
2322
}
24-
$choice = .prompt;
23+
$choice = prompt($prompt);
2524
}
2625

2726
my %options_by_key = @options.kv;
@@ -36,13 +35,13 @@ sub cls {
3635
#system(($*OS eq any <MSWin32 mingw>) ?? 'cls' !! 'clear');
3736
}
3837

39-
sub random ($low,$high) {int( ($high - $low).rand + $low ) + 1; };
38+
sub random ($low,$high) { ($low..$high).pick }
4039
#multi sub infix:<.?.> ($low,$high) {int( rand($high - $low) + $low ) + 1; };
4140

4241
class Option {
4342
has Str $.key is rw ;
4443
has Str $.text is rw ;
45-
has Str $.param is rw ;
44+
has $.param is rw ;
4645
}
4746

4847
class WObject {

0 commit comments

Comments
 (0)