git @ Cat's Eye Technologies HUNTER / 7e339e2
Import of Hunter version 1.0 revision 2007.1123 sources. Cat's Eye Technologies 10 years ago
4 changed file(s) with 214 addition(s) and 245 deletion(s). Raw diff Collapse all Expand all
33 </head>
44 <body>
55
6 <h1>HUNTER</h1>
6 <h2 style="text-align: center">Concurrent Maze Space Transformation<br>
7 (with Authentic Interrodent Communication)<br>
8 in the HUNTER Programming Language</h2>
79
8 <p><font size=-1>&nbsp;<img src="/images/icons/copyright.gif"
9 align=absmiddle width=12 height=12 alt="(c)" border=0>2002-2004 <a href="/">Cat's Eye Technologies</a>. All rights reserved.<br>
10 This software is OSI Certified Open Source Software.<br>
11 OSI Certified is a certification mark of the <a href="http://www.opensource.org/"><img
12 src="/images/icons/webicon.gif" alt="[WWW]" border=0 width=12 height=12>Open Source Initiative</a>.<br>
13 See the file <a href="license.txt">license.txt</a> for license information.</font>
14
15 <h3>Introduction</h3>
16
17 <p>To quote <a href="hunter.txt">hunter.txt</a>:
18
19 <blockquote>
20 <p>"It is perceived that one of the biggest problems in maintaining
10 <p>It is perceived that one of the biggest problems in maintaining
2111 interest in programming is the above linear growth of boredom
2212 compared to the usefulness of the program, resulting in an
2313 acute loss of enthusiasm on the part of the programmers and
2414 ultimately the abandonment of the software.</p>
2515
26 <p>"This document intends to address that by introducing a language
16 <p>This document intends to address that by introducing a language
2717 with new models for sharing, flow control, and data manipulation,
2818 which make all dependencies in a program globally accessible and
2919 radically oblique at the language level.</p>
3020
31 <p>"We introduce the language, which is a deterministic particle
21 <p>We introduce the language, which is a deterministic particle
3222 automaton based on mazespace-rewriting and critter-style message
33 passing and, being ASCII art, is inherently graphical in notation..."</p>
34 </blockquote>
23 passing and, being ASCII art, is inherently graphical in notation...</p>
3524
36 <h3>Implementation</h3>
3725
38 <p>The Perl 5 implementation of HUNTER requires the
39 <a href="/projects/virtcons/">_Console::Virtual
40 module</a>.</p>
26 <h1>The HUNTER Programming Language</h1>
27
28 <p>&copy;2000-2007 Cat's Eye Technologies. All rights reserved.</p>
29
30 <p>Each HUNTER program consists of a two-dimensional Cartesian-grid
31 playfield of any reasonable arbitrary size. Each square in this
32 grid is called a cell. Each cell may contain one of several
33 things, or be considered 'empty'. It may also contain a mouse,
34 which is a particularly special kind of thing. However, a mouse
35 must start in an otherwise empty square.</p>
36
37 <p>Mice are particularly special because they have agency. Unlike
38 walls and pieces of cheese, they do things. Primarily, they move
39 around. They do so at runtime.</p>
40
41 <p>The deterministic fashion a mouse moves around - always checking
42 east, then north, then west, then south, in each cell - and its
43 memory (each mouse keeps a 'map' of where it's been in it's head
44 and tries not to backtrack unless there is nowhere else new to
45 go) ensures that, given some time, and all other things being
46 equal, a mouse will traverse it's entire environment and will
47 return to where it started. The process then repeats, holding
48 the mouse in a state of perpetual live lock.</p>
49
50 <p>However, not all other things may be equal. Indeed, the mouse
51 may nibble on a bit of strychnine and die. Or, other mice may
52 be concurrently tranversing the same maze, and two mice may not
53 share the same space, so they may block each other's progress.</p>
54
55 <p>Mice may not move through walls but they may move through empty
56 space and on top of items found in the playfield, possibly
57 altering them (see below.)</p>
58
59 <p>Execution ends when all mice are dead.</p>
60
61 <p>An example HUNTER program might be:</p>
62
63 <pre>
64 ########
65 # 1#2#
66 # #### #
67 # #
68 # ######
69 # m#
70 #+######
71 # !#
72 ########
73 </pre>
74
75 <p>where</p>
76
77 <ul>
78 <li><code># indicates a wall</li>
79 <li><code>m indicates a mouse</li>
80 <li>the digits <code>0 to 9 represent types of cheese:
81 <ul>
82 <li><code>0</code> = cheddar</li>
83 <li><code>1</code> = american</li>
84 <li><code>2</code> = swiss</li>
85 <li><code>3</code> = gouda</li>
86 <li><code>4</code> = mozzarella</li>
87 <li><code>5</code> = farmer</li>
88 <li><code>6</code> = blue</li>
89 <li><code>7</code> = gorgonzola</li>
90 <li><code>8</code> = feta</li>
91 <li><code>9</code> = bat's-milk</li>
92 </ul></li>
93 <li><code>!</code> indicates a bit of strychnine</li>
94 <li><code>+</code> indicates a pinwheel</li>
95 <li><code>.</code> indicates a mouse turd</li>
96 <li><code>w</code> indicates a dead mouse carcass</li>
97 </ul>
98
99 <p>All other characters indicate other miscellaneous objects
100 apropos to being in a maze, with undefined semantics,
101 so they should be considered reserved.</p>
102
103 <p>Intermouse communication is done by mouse droppings. A mouse
104 can leave a message to some other mouse by creating a mouse
105 dropping where it currently is (assuming it has previously
106 eaten a piece of cheese.) Other mice can detect mouse
107 droppings and change their behaviour based on them.</p>
108
109 <p>How mice create droppings is defined by how each mouse is
110 trained. These mice are somewhat magical in that they can
111 be trained to perform physically improbable tasks, such as
112 turning one kind of cheese into another.</p>
113
114 <p>Mice are trained globally by the mazespace-rewriting
115 rules. These are the guidelines by which rodents live their
116 lives. Each rule must be on a line by itself and has the
117 following form:</p>
118
119 <pre>
120 *things&gt;droppings
121 </pre>
122
123 <p>For example,</p>
124
125 <pre>
126 *12&gt;21
127 </pre>
128
129 <p>Then, when a mouse encounters a piece of American cheese,
130 followed by a piece of Swiss cheese, it will eat them and
131 excrete a bit of Swiss cheese followed by a bit of American
132 cheese. This is just an example.</p>
133
134 <p>Mice will eat cheese but will not eat mouse droppings,
135 pinwheels, or other inedible items.</p>
136
137 <p>Specifying strychnine, walls, or mice on the left-hand side
138 of a rewriting rule is not guaranteed to be able to produce
139 a match. The behaviour of specifing mice on the right-hand
140 side of a rewriting rule is undefined.</p>
141
142 <h2>Implementation</h2>
143
144 <p>There is an implementation of HUNTER in Perl 5. It requires
145 the <a href="/projects/cons_virt/">Console::Virtual</a> module
146 to run.</p>
147
148 <p>Chris Pressey<br>
149 Winnipeg, Manitoba, Canada<br>
150 Original Oct 24 2000<br>
151 Revised for clarity Jan 26 2002<br>
152 HTML'ized Nov 23 2997</p>
41153
42154 </body></html>
+0
-132
doc/hunter.txt less more
0 Concurrent Maze Space Transformation
1 (with Authentic Interrodent Communication)
2 In The HUNTER Programming Language
3
4
5 It is perceived that one of the biggest problems in maintaining
6 interest in programming is the above linear growth of boredom
7 compared to the usefulness of the program, resulting in an
8 acute loss of enthusiasm on the part of the programmers and
9 ultimately the abandonment of the software.
10
11 This document intends to address that by introducing a language
12 with new models for sharing, flow control, and data manipulation,
13 which make all dependencies in a program globally accessible and
14 radically oblique at the language level.
15
16 We introduce the language, which is a deterministic particle
17 automaton based on mazespace-rewriting and critter-style message
18 passing and, being ASCII art, is inherently graphical in notation...
19
20
21 The HUNTER Programming Language
22 (c)2000-2002 Cat's Eye Technologies. All rights reserved.
23
24 Each HUNTER program consists of a two-dimensional Cartesian-grid
25 playfield of any reasonable arbitrary size. Each square in this
26 grid is called a cell. Each cell may contain one of several
27 things, or be considered 'empty'. It may also contain a mouse,
28 which is a particularly special kind of thing. However, a mouse
29 must start in an otherwise empty square.
30
31 Mice are particularly special because they have agency. Unlike
32 walls and pieces of cheese, they do things. Primarily, they move
33 around. They do so at runtime.
34
35 The deterministic fashion a mouse moves around - always checking
36 east, then north, then west, then south, in each cell - and its
37 memory (each mouse keeps a 'map' of where it's been in it's head
38 and tries not to backtrack unless there is nowhere else new to
39 go) ensures that, given some time, and all other things being
40 equal, a mouse will traverse it's entire environment and will
41 return to where it started. The process then repeats, holding
42 the mouse in a state of perpetual live lock.
43
44 However, not all other things may be equal. Indeed, the mouse
45 may nibble on a bit of strychnine and die. Or, other mice may
46 be concurrently tranversing the same maze, and two mice may not
47 share the same space, so they may block each other's progress.
48
49 Mice may not move through walls but they may move through empty
50 space and on top of items found in the playfield, possibly
51 altering them (see below.)
52
53 Execution ends when all mice are dead.
54
55 An example HUNTER program might be:
56
57 ########
58 # 1#2#
59 # #### #
60 # #
61 # ######
62 # m#
63 #+######
64 # !#
65 ########
66
67 where
68
69 # indicates a wall
70 m indicates a mouse
71 the digits 0 to 9 represent types of cheese
72 0 = cheddar
73 1 = american
74 2 = swiss
75 3 = gouda
76 4 = mozzarella
77 5 = farmer
78 6 = blue
79 7 = gorgonzola
80 8 = feta
81 9 = bat's-milk
82 ! indicates a bit of strychnine
83 + indicates a pinwheel
84 . indicates a mouse turd
85 w indicates a dead mouse carcass
86
87 other characters indicate other miscellaneous objects
88 apropos to being in a maze, with undefined semantics,
89 so they should be considered reserved
90
91 Intermouse communication is done by mouse droppings. A mouse
92 can leave a message to some other mouse by creating a mouse
93 dropping where it currently is (assuming it has previously
94 eaten a piece of cheese.) Other mice can detect mouse
95 droppings and change their behaviour based on them.
96
97 How mice create droppings is defined by how each mouse is
98 trained. These mice are somewhat magical in that they can
99 be trained to perform physically improbable tasks, such as
100 turning one kind of cheese into another.
101
102 Mice are trained globally by the mazespace-rewriting
103 rules. These are the guidelines by which rodents live their
104 lives. Each rule must be on a line by itself and has the
105 following form:
106
107 *things>droppings
108
109 For example,
110
111 *12>21
112
113 Then, when a mouse encounters a piece of American cheese,
114 followed by a piece of Swiss cheese, it will eat them and
115 excrete a bit of Swiss cheese followed by a bit of American
116 cheese. This is just an example.
117
118 Mice will eat cheese but will not eat mouse droppings,
119 pinwheels, or other inedible items.
120
121 Specifying strychnine, walls, or mice on the left-hand side
122 of a rewriting rule is not guaranteed to be able to produce
123 a match. The behaviour of specifing mice on the right-hand
124 side of a rewriting rule is undefined.
125
126
127
128 Chris Pressey
129 Winnipeg, Manitoba, Canada
130 Original Oct 24 2000
131 Revised for clarity Jan 26 2002
+0
-32
doc/license.txt less more
0 Copyright (c)2001, Cat's Eye Technologies.
1 All rights reserved.
2
3 Redistribution and use in source and binary forms, with or without
4 modification, are permitted provided that the following conditions
5 are met:
6
7 Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9
10 Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in
12 the documentation and/or other materials provided with the
13 distribution.
14
15 Neither the name of Cat's Eye Technologies nor the names of its
16 contributors may be used to endorse or promote products derived
17 from this software without specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
20 CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
27 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 POSSIBILITY OF SUCH DAMAGE.
00 #!/usr/bin/perl
11
22 # HUNTER - concurrent maze-space traversal language
3 # v2002.01.26 Chris Pressey, Cat's Eye Technologies
4
5 # Copyright (c)2002, Cat's Eye Technologies.
3 # v2007.1123 Chris Pressey, Cat's Eye Technologies
4
5 # Copyright (c)2002-2007, Chris Pressey, Cat's Eye Technologies.
66 # All rights reserved.
7 #
7 #
88 # Redistribution and use in source and binary forms, with or without
99 # modification, are permitted provided that the following conditions
1010 # are met:
11 #
12 # Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 #
15 # Redistributions in binary form must reproduce the above copyright
16 # notice, this list of conditions and the following disclaimer in
17 # the documentation and/or other materials provided with the
18 # distribution.
19 #
20 # Neither the name of Cat's Eye Technologies nor the names of its
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
25 # CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
26 # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 # DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
29 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
30 # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
32 # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
33 # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 # POSSIBILITY OF SUCH DAMAGE.
37
38 # usage: [perl] hunter[.pl] [-no-eat] [-delay xxx] hunter-playfield-file
39 # requirements: Curses, or ANSI terminal, or Win32 Console.
11 #
12 # 1. Redistributions of source code must retain the above copyright
13 # notices, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notices, this list of conditions, and the following disclaimer in
16 # the documentation and/or other materials provided with the
17 # distribution.
18 # 3. Neither the names of the copyright holders nor the names of their
19 # contributors may be used to endorse or promote products derived
20 # from this software without specific prior written permission.
21 #
22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING, BUT NOT
24 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 # COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 # POSSIBILITY OF SUCH DAMAGE.
34
35 # usage: [perl] hunter[.pl] [-no-eat] [-delay ms] hunter-playfield-file
36 # requirements: Console::Virtual.
4037
4138 # history: v2000.08.05 - started prototyping (from worb.pl).
4239 # v2000.08.07 - added deterministic traversal.
4845 # v2002.01.26 - fixed behaviour of eating of cheese
4946 # added command line options
5047 # does not rely on "\n" in screen driver
51
52 # Uncomment this line to use a specific display driver.
53 # BEGIN { $_Console::Virtual::setup{display} = 'ANSI'; }
54
55 use _Console::Virtual 2001.0123
48 # v2007.1123 - use latest version of Console::Virtual
49 # use Time::HiRes if avail, delay in ms
50 # use strict qw(vars refs subs)
51 # updated BSD license (no "REGENTS")
52
53 use strict qw(vars refs subs);
54
55 # This allows us to keep Console::Virtual in same directory as script
56 BEGIN { use File::Basename; push @INC, dirname($0); }
57
58 # Uncomment these lines to use specific display/input/color drivers.
59 # BEGIN { $Console::Virtual::setup{display} = 'ANSI'; }
60 # BEGIN { $Console::Virtual::setup{input} = 'Teletype'; }
61 # BEGIN { $Console::Virtual::setup{color} = 'ANSI16'; }
62
63 use Console::Virtual 2007.1122
5664 qw(getkey display gotoxy clrscr clreol
57 normal inverse bold update_display);
65 normal inverse bold update_display color);
66
67 # This lets us do sub-second sleeps, if Time::HiRes is available.
68 my $sleep = sub($) { sleep(shift); };
69 my $found_time_hires = 0;
70 foreach my $c (@INC)
71 {
72 $found_time_hires = 1 if -r "$c/Time/HiRes.pm";
73 }
74 if ($found_time_hires) {
75 require Time::HiRes;
76 $sleep = sub($) { Time::HiRes::sleep(shift); };
77 }
5878
5979 ### GLOBALS ###
6080
61 @mouse = ();
62 @playfield = ();
63 @mouse_at_cache = ();
64 @rule = ();
65
66 $x = 0; $y = 0;
67 $no_eat = 0; # compatibility flag
68 $delay = 300;
81 my @mouse = ();
82 my @playfield = ();
83 my @mouse_at_cache = ();
84 my @rule = ();
85
86 my $x = 0;
87 my $y = 0;
88
89 my $maxx = 1;
90 my $maxy = 1;
91
92 my $no_eat = 0; # compatibility flag
93 my $delay = 100;
6994
7095 ### SUBS ###
7196
7398 {
7499 gotoxy(1,1);
75100 my $i; my $j; my $p;
76 for($j = 0; $j <= $maxy; $j++)
77 {
78 for($i = 0; $i <= $maxx; $i++)
101 for ($j = 0; $j <= $maxy; $j++)
102 {
103 for ($i = 0; $i <= $maxx; $i++)
79104 {
80105 if (is_mouse_at($i,$j))
81106 {
124149 }
125150
126151 open PLAYFIELD, $ARGV[0];
127 while(defined($line = <PLAYFIELD>))
152 while (defined(my $line = <PLAYFIELD>))
128153 {
129154 my $i;
130155 chomp($line);
161186 close PLAYFIELD;
162187
163188 clrscr();
189 color('white', 'black');
164190
165191 draw_playfield();
166192
167 $start_time = time();
168 $tick = 1;
169 while(1)
193 while (1)
170194 {
171195 my $mouse;
172196 my $pole;
210234 die "Can't be!";
211235 }
212236
213 if((defined($mouse->{been}[$new_x][$new_y]) and $mouse->{been}[$new_x][$new_y])
237 if ((defined($mouse->{been}[$new_x][$new_y]) and $mouse->{been}[$new_x][$new_y])
214238 or not vacant($new_x, $new_y))
215239 {
216240 $mouse->{stack}[$#{$mouse->{stack}}]++;
311335 exit(0);
312336 }
313337 update_display();
314 for($i = 1; $i < $delay; $i++)
315 {
316 gotoxy(1,20);
317 }
338 &$sleep($delay / 1000);
318339 }
319340
320341 ### END of hunter.pl ###