'Flip-card' animation code appear to be not working

Hello there, I am reading Modeling Nature Cellular Automata by Richard J Gaylord book and I tried ‘flip-card’ animation codes (p.12 inserted below) on Wolfram Mathematica (bc I interest to see how it works) and seems to be not working. How can I fix it? Please help and thank you.

ShowCA[list_, opts__] :=
 Map[show[
    Graphics[
     RasterArray[
      list[[#]] {val1 -> RGBColor[x1, y1, z1], 
        val2 -> RGBColor[x2, y2, z2], ...}]], opts] &, 
  Range[Length[list]]]

Syntax::sntxf: "list[[#]]" cannot be followed by "{val1->RGBColor[x1,y1,z1],val2->RGBColor[x2,y2,z2],...}".

Perhaps a /. is missing between list[[#]] and {val1 ->

Thank you for taking your time responding to my message. I appreciate you.
Re-run. It stated the same. Book was published 1996, old codes perhaps.

ShowCA[list_, opts__] :=
 Map[Show[Graphics[RasterArray[ list[ [#] ] /.
       {val1 -> RGBColor[x1, y1, z1], 
        val2 -> RGBColor[x2, y2, z2], ...}]], opts] &, 
  Range[Length[list]]   ]

Syntax::sntxf: "list[[#]]/." cannot be followed by "{val1->RGBColor[x1,y1,z1],val2->RGBColor[x2,y2,z2],...}".

Another problem: ... is not a valid syntax.

val2 -> RGBColor[x2, y2, z2], ...

No error if it is removed

ShowCA[list_, opts__] := 
 Map[Show[
    Graphics[
     RasterArray[
      list[[#]] /. {val1 -> RGBColor[x1, y1, z1], 
        val2 -> RGBColor[x2, y2, z2]}]], opts] &, Range[Length[list]]]

Thank you for taking your time responding to my message. I appreciate you. I took your advice, removed three dots and ran. It showed no error, but did not show the animation.
I am just wondering do I need to download a certain ‘add-on’ software in order to see the animation. Best.

What arguments are you passing to ShowCA?

Hello Rohit Namjoshi and thanks again.

From Richard J. Gaylord (the author) and that was it.

We can create a “flip-card” animation of the evolution of a CA using
the following command:

ShowCA[list_, opts_] ::
Map[Show[Graphics[RasterArray[list[[#]] /.
{vall -> RGBColor[xl, yl, zl],
val2 -> RGBColor[x2, y2, z2], ... }]], opts]&, Range[Length[list]]]

Hi Hoa,

Seems like you are new to the Wolfram Language / Mathematica. The code you shared just defines a function named ShowCA. You have to evaluate an expression involving the function and its arguments. Simple example

Define a function named myFunction that takes a single argument and evaluates to it’s square.

myFunction[arg_] := arg^2

Evaluate

myFunction[4]
(* 16 *)

I don’t have the book you are referring to but I am guessing it is trying to do something like this

ClearAll@animateCA;
animateCA[rule_Integer, steps_Integer, 
  colorRules : List[__Rule] : {0 -> LightBlue, 1 -> Red}] :=
  Animate[
  ArrayPlot[
   ArrayPad[CellularAutomaton[rule, {{1}, 0}, {n, All}],
    {{0, steps - n}, {steps - n, steps - n}}],
   ColorRules -> colorRules],
  {n, 0, steps, 1}]

Then you can evaluate

animateCA[30, 75]

Different rule and colors

animateCA[73, 75, {0 -> LightGreen, 1 -> Magenta}]

Note: I adapted the code from this answer on MSE.

Thank you for taking your time responding to my message. I appreciate you.
I ran your codes. Worked. It’s wonderful. I learned something new today.

Yes, You are right. I am new to both Mathematica software and Cellular Automata.
I came across Modeling Nature Cellular Automata with Mathematica by Richard J. Gaylord 1996ed. and thought give it a try and learned Mathematica at the same time. Thus, I registered with Wolfram Mathematica.

You have any books/sites suggestions for me about Cellular Automata with Mathematica. There is not much on Amazon.com
Again, thank you.

Hi Hoa,

You are welcome, glad you found it useful.

To learn more about the WL, take a look at An Elementary Introduction to the Wolfram Language by Stephen Wolfram. It is available online for free.

A New Kind of Science, also by Stephen Wolfram has a lot of information on cellular automata. It is also available online for free.