MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Creating Raster Image Animation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21905] Re: Creating Raster Image Animation
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Fri, 4 Feb 2000 02:54:38 -0500 (EST)
  • References: <87au4p$nlt@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Mike,

In      ShowLife[list_, opts__Rule]:=

try changing      opts__Rule     to     opts___Rule
and for good measure change further to to      opts___?OptionQ
The last form allows :> aas well as -> and also nested lists of options.

Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565


"Mike Fuller" <mmfuller at unm.edu> wrote in message
news:87au4p$nlt at smc.vnet.net...
> I'm trying to get a graphical representation of a cellular automata to
work.
> I've implemented Conway's Game of Life using code provided by Gaylord et
al.
> The code creates a matrix showing the location of "living" and "dead"
cells.
> This program works fine. But I'm having trouble getting an animated
> representation to work. When I try to evaluate the output from the Game,
> using a separate program, it simply produces the same output as the Game
(a
> matrix of values). Does anyone have any idea how I can modify the code to
my
> ShowLife program (below) get the desired result?
>
> Thanks,
> Mike
>
>  Here's the code for the CA:
>
> LifeGame[s_, t_]:=
>     Module[{initconfig, livingNghbrs, update},
>       initconfig = Table[Random[Integer], {s}, {s}];
>       livingNghbrs[mat_] :=
>         Apply[Plus, Map[RotateRight[mat, #]&,
>             {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},
>             {1,0},{1,1}}]];
>       update[1,2]:= 1;
>       update[_,3]:= 1;
>       update[_,_]:= 0;
>       Attributes[update]=Listable;
>       FixedPointList[update[#, livingNghbrs[#]]&,
>                        initconfig, t]]
>
> And here's the code for the graphic animation:
>
> ShowLife[list_, opts__Rule]:=
>     Map[(Show[Graphics[RasterArray[
>         Reverse[list[[#]]/.
>             {1-> RGBColor[1,0,0],
>             0-> RGBColor[0,0,0]}]],
>         AspectRatio-> Automatic, opts]])&,
>     Range[Length[list]]]
>
>



  • Prev by Date: Re: image 2-d Fouriertransform ?
  • Next by Date: Re: Check[] *and* Off[]
  • Previous by thread: Creating Raster Image Animation
  • Next by thread: Re: Evaluating a Notebook down to a selected point (without mousing)?