All pastes #195926 Raw Edit

Stuff

public text v1 · immutable
·published 2006-10-10 04:51 UTC
rendered paste body
sub new {
    my ($class, $height, $width) = shift @_;

    my $self = bless {}, $class;
    $self->{height} = $height;
    $self->{width} = $width;
    $self->{bot_coord} = [0,0];

    # The maze is represented by a grid. Each location either has a space or a
    # wall. $grid[0][0] being the top left and $grid[$width][$height] being
    # the bottom right corner. A 0 represents a space, and a 1 is a wall.

    for my $x (0 .. ($width-1)) {
        for my $y (0..$height-1)) {
            $self->{grid}[$x][$y] = $SPACE;
        }
    }
    return $self;

}