git @ Cat's Eye Technologies Ypsilax / 56c13db
Add truth-machine example, and fix the '0' bugs it exposed. catseye 12 years ago
2 changed file(s) with 21 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
0 ( ) ( )
1 ------ ------
2 N:0N:0 N:1N:1
3 T: T:0 T: T:! ( )
4 ! 1!
5 ----
6 IN:
7 OUT:
8484 } until $playfield->{data}[$x][$y] eq '(' and ((not defined($playfield->{data}[$x][$y-1])) or $playfield->{data}[$x][$y-1] eq ' ' or $y == 0);
8585 my $x2 = $x;
8686 do { $x2++ } until $playfield->{data}[$x2][$y] eq ')';
87 return [$x+1, $y+1, ($x2-$x)-1, int((($x2-$x)-1)/2), $playfield->{data}[$x2-1][$y]];
87 my $wild = $playfield->{data}[$x2-1][$y];
88 $wild = ' ' if not defined($wild);
89 return [$x+1, $y+1, ($x2-$x)-1, int((($x2-$x)-1)/2), $wild];
8890 }
8991
9092 sub apply_rule_randomly($$)
112114 {
113115 for($j = $y; $j < $y + $h; $j++)
114116 {
115 my $q1 = $playfield->{data}[$i][$j] || ' ';
116 my $q2 = $playfield->{data}[$i+$dx][$j+$dy] || ' ';
117 my $q1 = $playfield->{data}[$i][$j];
118 $q1 = ' ' if not defined($q1);
119 my $q2 = $playfield->{data}[$i+$dx][$j+$dy];
120 $q2 = ' ' if not defined($q2);
117121 if ($q1 eq $wild and $wild ne ' ')
118122 {
119123 }
131135 for($j = $y; $j < $y + $h; $j++)
132136 {
133137 my $q1 = $playfield->{data}[$i][$j];
138 $q1 = ' ' if not defined($q1);
134139 if ($q1 eq $wild and $wild ne ' ')
135140 {
136141 } else
186191 {
187192 for($i = 0; $i <= $maxx; $i++)
188193 {
189 display($playfield->{data}[$i][$j] || ' ');
194 if (defined $playfield->{data}[$i][$j]) {
195 display($playfield->{data}[$i][$j]);
196 } else {
197 display(' ');
198 }
190199 }
191200 gotoxy(1, $j+3);
192201 }