Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

using publically available GOL patterns

  • Loading branch information...
commit ded29386c3c1cfa1bb48af873694c70c287d1de0 1 parent bf7d924
hakim authored
Showing with 357 additions and 12 deletions.
  1. +357 −12 scratch/perl/life/life.pl
369 scratch/perl/life/life.pl
View
@@ -8,7 +8,7 @@ sub string_to_grid {
my $string = shift;
return [
map {
- [ map { $_ eq '#' ? 1 : 0 } split //, $_ ];
+ [ map { $_ eq 'O' ? 1 : 0 } split //, $_ ];
} split /\n/, $string,
]
}
@@ -16,7 +16,7 @@ sub grid_to_string {
my $grid = shift;
return join "\n", map {
join '', map {
- $_ ? '#' : '.';
+ $_ ? 'O' : '.';
} @$_;
} @$grid;
}
@@ -71,18 +71,9 @@ sub multizip {
return @list;
}
-my $grid = string_to_grid(<<EOF);
+my $METHUSELAH = <<EOF;
............................................
............................................
-.........................#..................
-.......................#.#..................
-.............##......##............##.......
-............#...#....##............##.......
-.##........#.....#...##.....................
-.##........#...#.##....#.#..................
-...........#.....#.......#..................
-............#...#...........................
-.............##.............................
............................................
............................................
............................................
@@ -91,6 +82,9 @@ sub multizip {
............................................
............................................
............................................
+.................OO...O.O...................
+.................OO....O....................
+.......................O....................
............................................
............................................
............................................
@@ -101,9 +95,360 @@ sub multizip {
............................................
............................................
............................................
+............................................
+............................................
+............................................
+............................................
+EOF
+
+my $BREEDER = <<EOF;
+............................................
+............................................
+.........................O..................
+.......................O.O..................
+.............OO......OO............OO.......
+............O...O....OO............OO.......
+.OO........O.....O...OO.....................
+.OO........O...O.OO....O.O..................
+...........O.....O.......O..................
+............O...O...........................
+.............OO.............................
+............................................
+............................................
+............................................
+............................................
+............................................
+............................................
+............................................
+............................................
+............................................
+............................................
+............................................
+............................................
+............................................
+............................................
+............................................
+............................................
+............................................
+............................................
+EOF
+
+my $COW = <<EOF;
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+......OO.......OO..OO..OO..OO..OO..OO..OO..OO..OO..OO..OO..OO.......................
+......OO....O.OOO..OO..OO..OO..OO..OO..OO..OO..OO..OO..OO..OO...OO..................
+..........OO.O.................................................O.O..................
+..........OO...OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO....................
+..........OO.O..................................................O...................
+......OO....O.OOO..OO..OO..OO..OO..OO..OO..OO..OO..OO..OO..OO..OO...................
+......OO.......OO..OO..OO..OO..OO..OO..OO..OO..OO..OO..OO..OO.......................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+....................................................................................
+EOF
+
+my $CORDERSHIP = <<EOF;
+...............................................................................
+...............................................................................
+...............................................................................
+...............................................................................
+...............................................................................
+.....................................OO.O......................................
+....................................OOO.O......O.O.............................
+...................................O....O.O....O...............................
+....................................OO......O.O...O............................
+.....................................O...O..O..OO..............................
+........................................O.OO...O...............................
+.......................................O.O................OO...................
+.......................................O.O................OO...................
+...............................................................................
+...............................................................................
+...............................................................................
+...............................................................................
+...............................................................................
+...............................................................................
+..................................................................OO...........
+.........................................................OO.......OO...........
+............................................O.........O.OOOO...................
+.......................................O...OOOOO.....OO.O...OO.................
+......................................O.O.......OO....O..OO.OO.................
+......................................O.......O.OO.....OOOOOO..................
+.......................................O........OO......O......................
+........................................O...OOOO...............................
+.............................................OOO...............................
+.............................O.O.........OO....................................
+.............................O.O.O......O.O....................................
+............................O..OO.O....OO......................................
+.............................OO...O.O.OO.O.....................................
+.............................OO...OO.OOOOO.....................................
+.................................O.OO...OO.....................................
+................................O.O............................................
+.......OO.O....................................................................
+......OOO.O......O.O...........................................................
+.....O....O.O....O.............................................................
+......OO......O.O...O..........................................................
+.......O...O..O..OO...........O................................................
+..........O.OO...O...........OOO...............................................
+.........O.O.................O..O..............................................
+.........O.O................O....O.............................................
+.............................O.................................................
+...............................................................................
+.............................O..O..............................................
+..............................O.O..............................................
+...............................................................................
+..........................O....................................................
+.........................OOO...................................................
+........................OO.OO..................................................
+..............O........OO.O.....O..............................................
+.........O...OOOOO....OO......OO...............................................
+........O.O.......OO..OO.......OO..............................................
+........O.......O.OO...........................................................
+.........O........OO...........................................................
+..........O...OOOO.............................................................
+...............OOO.............................................................
+...............................................................................
+...............................................................................
+...............................................................................
+................OO.............................................................
+................OO.............................................................
+...............................................................................
+...............................................................................
+...............................................................................
+...............................................................................
EOF
+
+my $TOAD_HASSLER = <<EOF;
+..........................................
+..........................................
+..........................................
+..........................................
+..........................................
+..........................................
+..........................................
+...............O..........................
+...............O..............O...........
+..............O.O.............O...........
+...............O.............O.O..........
+...............O......O.......O...........
+...............O......OO......O...........
+...............O......OO......O...........
+..............O.O......O......O...........
+...............O.............O.O..........
+...............O..............O...........
+..............................O...........
+..........................................
+..........................................
+..........................................
+..........................................
+EOF
+
+my $BEACON_MAKER = <<EOF;
+........................................................
+........................................................
+........................................................
+........................................................
+........................................................
+........................................................
+........................................................
+........................................................
+........................................................
+........................................................
+........................................................
+..................................OO....................
+.................................O.O....................
+................................O.......................
+...............................O........................
+..............................O.........................
+.............................O..........................
+............................O...........................
+...........................O............................
+..........................O.............................
+.........................O..............................
+........................O...............................
+.......................O................................
+....................OOO.................................
+......................O.................................
+........................................................
+........................................................
+........................................................
+........................................................
+........................................................
+........................................................
+........................................................
+........................................................
+........................................................
+........................................................
+........................................................
+EOF
+my $QUEEN_BEE = <<EOF;
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+.......................................O..........................................
+.....................................O.O..........................................
+....................................O.O...........................................
+...................................O..O...........................................
+....................................O.O...........................................
+.....................................O.O..........................................
+.......................................O..........................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+EOF
+
+my $QUEEN_BEE_SHUTTLE = <<EOF;
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+.......................................O..........................................
+.....................................O.O..........................................
+....................................O.O...........................................
+..............................OO...O..O...........................................
+..............................OO....O.O...........................................
+.....................................O.O........OO................................
+.......................................O........O.O...............................
+..................................................O...............................
+..................................................OO..............................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+..................................................................................
+EOF
+
+my $PUFF_SUPPRESSOR = <<EOF;
+............................................................................
+............................................................................
+............................................................................
+............................................................................
+............................................................................
+............................................................................
+............................................................................
+................................................O...........................
+..............................................OO.O..........................
+..............................................OO...O........................
+............................................O...OO.O.....O..................
+............................................OOOO.OO...OOOO.......O.O........
+..........................................O......O....OOO.....O.O..O........
+..........................................OOOOOOO...O...O....O..O...........
+.......................................O.O......OO..O...O.O.OO....O.........
+......................................OOOOOOOOO.....O..OO........O..........
+.....................................OO..............O.OO.OOOO...O..O.......
+....................................OO....OO.O..........O...O..O.O..........
+.....................................OO....O........OOO......O.O.O..O.......
+.............................................O......OO......O....OO.........
+.....................................OO....O........OOO......O.O.O..O.......
+....................................OO....OO.O..........O...O..O.O..........
+.....................................OO..............O.OO.OOOO...O..O.......
+......................................OOOOOOOOO.....O..OO........O..........
+.......................................O.O......OO..O...O.O.OO....O.........
+..........................................OOOOOOO...O...O....O..O...........
+..........................................O......O....OOO.....O.O..O........
+............................................OOOO.OO...OOOO.......O.O........
+............................................O...OO.O.....O..................
+..............................................OO...O........................
+..............................................OO.O..........................
+................................................O...........................
+............................................................................
+............................................................................
+............................................................................
+............................................................................
+............................................................................
+............................................................................
+............................................................................
+............................................................................
+............................................................................
+............................................................................
+EOF
+
+my $grid = string_to_grid($PUFF_SUPPRESSOR);
for (1..1000) {
say grid_to_string($grid); say "!\n";
+ select undef, undef, undef, 0.15;
$grid = next_generation($grid);
}
Please sign in to comment.
Something went wrong with that request. Please try again.