Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Dial up some obscure stats for the Chutes and Ladders game

by choroba (Bishop)
on Feb 22, 2015 at 11:53 UTC ( #1117468=note: print w/replies, xml ) Need Help??


in reply to Re^2: Dial up some obscure stats for the Chutes and Ladders game
in thread Dial up some obscure stats for the Chutes and Ladders game

In case of the simple rules, you can't get to the square 100 before the 7th turn:
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; my %special = ( ... ); # copy from the OP my %reachable = ( 0 => undef ); my $turn = 0; while (not exists $reachable{100}) { my %next; for my $square (keys %reachable) { for my $spin (1 .. 6) { my $target = $square + $spin; next if $target > 100; undef $next{$target}; undef $next{ $special{$target}{end} } if $special{$target} +; } } undef @reachable{ keys %next }; say ++$turn, ': ', join ' ', sort { $a <=> $b } keys %reachable; } say "$turn";
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1117468]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2019-09-15 07:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (178 votes). Check out past polls.

    Notices?