Tabulation method is usually adopted to describe the mapping relation of the analytic
function of the local rules of Cellular Automaton. Although tabulation method is quite suitable
to describe the mapping relation among discrete variables, there are numerous if-else
sentences for the state decision of independent variables in computer programming. In this
paper, we define an analytic function of the local rules of an Elementary Cellular Automaton
by constructing the recognition function of the states of the cell and the neighbors.
Therefore, a huge number of calculations by if-else sentences are transferred to the function
calculation due to the adoption of the function of the local rules during the evolution
of the ECA. Finally, the simulation results show that the programming structure is optimized
and the programming efficiency is enhanced. In addition, the proposed method
can also be extended to other 2-state cellular automata.