git @ Cat's Eye Technologies Circute / 40a4e10
Initial import of Circute version 1.0 revision 2007.0503 sources. Cat's Eye Technologies 8 years ago
11 changed file(s) with 263 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 =
1 =
2 #######== = =========
3 # = = = =
4 ==N== = ==N== = ==N==
5 = = = = = = = =
6 ===== = ===== = =====
7 = = = = =
8 ==============N==============
9
10 =========
11 = =
12 ==N== =
13 = = =
14 ===== =
15 = =
16 =========
0 ####
1 # #
2 =N###
3 = #
4 = ###
5 = # #
6 = #N#
7 = =
8 = =
9 = =
10 = =
11 = =
12 = =
13 = =
14 = =
15 = =
16 = =
17 = =
18 = =
19 =
20 ===============================================================#
0 =
1 =
2 #######== ===N=== =========
3 # = = = = =
4 ==N== = ==N== ==N== = ==N==
5 = = = = = = = = = =
6 ===== = ===== ===== = =====
7 = = = = = =
8 ============= =============
0 =========
1 = =
2 ==N== =
3 = = =
4 ===== =
5 = =
6 =========
0 ============================================================================
1 =
2 =N#
3 ==
0
1 # #
2 # #
3 # #
4 ##### #####
5 # # # #
6 =N## # =N## #
7 = # # = # #
8 = =N## = =N##
9 = = = =
10 = = = =
11 = = = =
12 = = # = =
13 # = = = #
14 # = = = #
15 # = = = #
16 # = = = #
17 # = = = #
18 # = = = #
19 # = = = #
20 # = = = #
21 # ====== #
0
1
2 ==========
3 = = =
4 #N# === =
5 # # = = =
6 ### =N= =
7 # # #N#
8 ##### # #
9 ###
10 #
11 =N=
12 = =
13 === ==#
14 = =
15 ====
0
1
2 ==========================
3 = =
4 ==== ###N### ==== =
5 = = # # = = =
6 =N= = =N= =N= = =N= =
7 = = = = = = = = = = ##N====
8 === = === === = === # =
9 = = = = = = # =======================
10 ======== ======== #
11 = = #
12 = = #
13 = = #
14 = = #
15 = = #
16 = = #
17 ===N=== #
18 # #
19 # #
20 ####################
0
1
2 ==========================
3 = =
4 ==== ###N### ==== =
5 = = # # = = =
6 =N= = =N= =N= = =N= =
7 = = = = = = = = = = ##N====
8 === = === === = === # =
9 = = = = = = # =======================
10 ==== = = ==== #
11 = = = = #
12 === = = === #
13 = = = = = = #
14 === = = =N= #
15 = = = = #
16 ===== ===== #
17 ===N=== #
18 # #
19 # #
20 ####################
0 #!/usr/bin/perl
1 # eg/circute/script/circute.pl - automatically generated from eg/circute/src/circute.alp by:
2 # alpaca.pl v0.93
3 # http://catseye.webhop.net/projects/alpaca/
4 ######################################################
5
6 use Alpaca qw(true false guess
7 adjacent_state adjacent_class
8 load_playfield display_playfield process_playfield);
9
10 sub SpaceStateRules {
11 return 'Space'
12 };
13
14 sub NANDStateRules {
15 return 'NAND'
16 };
17
18 sub WireStateRules {
19 return 'Spark' if ($Playfield->[$x-1][$y] eq 'Spark' or $Playfield->[$x+1][$y] eq 'Spark' or $Playfield->[$x][$y-1] eq 'Spark' or $Playfield->[$x][$y+1] eq 'Spark' or ($Playfield->[$x][$y+1] eq 'NAND' and ($Playfield->[$x-1][$y+1] eq 'Wire' or $Playfield->[$x+1][$y+1] eq 'Wire')) or ($Playfield->[$x][$y-1] eq 'NAND' and ($Playfield->[$x-1][$y-1] eq 'Wire' or $Playfield->[$x+1][$y-1] eq 'Wire')));
20 return 'Wire'
21 };
22
23 sub SparkStateRules {
24 return 'Tail' if ($Playfield->[$x-1][$y] eq 'Tail' or $Playfield->[$x+1][$y] eq 'Tail' or $Playfield->[$x][$y-1] eq 'Tail' or $Playfield->[$x][$y+1] eq 'Tail' or ($Playfield->[$x][$y+1] eq 'NAND' and $Playfield->[$x-1][$y+1] eq 'Spark' and $Playfield->[$x+1][$y+1] eq 'Spark') or ($Playfield->[$x][$y-1] eq 'NAND' and $Playfield->[$x-1][$y-1] eq 'Spark' and $Playfield->[$x+1][$y-1] eq 'Spark'));
25 return 'Spark'
26 };
27
28 sub TailStateRules {
29 return 'Wire' if (1);
30 return 'Tail'
31 };
32
33 $Appearance = {
34 'NAND' => 'N',
35 'Space' => ' ',
36 'Spark' => '#',
37 'Tail' => '-',
38 'Wire' => '=',
39
40 };
41
42 $InputCodec = {
43 'N' => 'NAND',
44 ' ' => 'Space',
45 '#' => 'Spark',
46 '-' => 'Tail',
47 '=' => 'Wire',
48
49 };
50
51 $StateRule = {
52 'NAND' => \&main::NANDStateRules,
53 'Space' => \&main::SpaceStateRules,
54 'Spark' => \&main::SparkStateRules,
55 'Tail' => \&main::TailStateRules,
56 'Wire' => \&main::WireStateRules,
57
58 };
59
60 load_playfield($ARGV[0]);
61
62 display_playfield();
63
64 while (!$done)
65 {
66 process_playfield();
67 display_playfield();
68 }
69
70 exit(0);
71
72 ### END ###
0 /*
1 * The Circute cellular automaton, expressed in ALPACA.
2 * Circa summer 2005, Chris Pressey.
3 * BSD License added May 3 2007
4 */
5
6 /*
7 * Copyright (c)2007 Chris Pressey, Cat's Eye Technologies.
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright
15 * notices, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notices, this list of conditions, and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
20 * 3. Neither the names of the copyright holders nor the names of their
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38 state Space " ";
39 state NAND "N";
40 state Wire "="
41 to Spark when
42 < Spark or > Spark or ^ Spark or v Spark or
43 (v NAND and (v< Wire or v> Wire)) or
44 (^ NAND and (^< Wire or ^> Wire));
45 state Spark "#"
46 to Tail when
47 < Tail or > Tail or ^ Tail or v Tail or
48 (v NAND and v< Spark and v> Spark) or
49 (^ NAND and ^< Spark and ^> Spark);
50 state Tail "-"
51 to Wire.