Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 33 lines (25 sloc) 0.539 kB
366e903 @kthakore Added cpan chapter example
kthakore authored
1 use strict;
2 use warnings;
3 use SDL;
4 use SDLx::App;
5
6 use Game::Life;
7 use Data::Dumper;
8
9 my $app = SDLx::App->new( w=>400, h=> 400);
10
11 my $game = new Game::Life(100);
12 my $starting = [ [ 1, 1, 1 ], [ 1, 0, 0 ], [ 0, 1, 0 ] ];
13
14 $game->place_points( 96, 96, $starting );
15 for ( 1 .. 100 ) {
16 my $grid = $game->get_grid();
17 $app->draw_rect( undef, 0 );
18 foreach( 0..100 )
19 {
20 my $x = $_;
21 foreach( 0..100)
22 {
23 $app->draw_rect( [$x*4, $_*4, 4,4 ], 0xFF0000FF ) if $grid->[$x][$_];
24 }
25
26 }
27 $game->process();
28 $app->update();
29 }
30
31
32 sleep(2);
Something went wrong with that request. Please try again.