In computer science, Iteration is the act of repeating instructions inside an algorithm, implemented either by the control structure of a loop or by direct or indirect recursive calls. Despite all kinds of low level loops supported by various programming languages, so called Iterators allow for traversing data container hiding the concrete implementation, i.e. linked list or array. While recursion can be considered as a special case of iteration, iteration describes the style of imperative programming in contrast to the more declarative nature of recursion. In a stricter sense, to distinguish iteration from recursion, iteration implies performing a loop inside the scope of a subroutine restricted to one stack frame in a call hierarchy, or equivalently processed by the same local iterator object.
- 1 Iterations
- 2 Iterative Algorithms
- 3 See also
- 4 Selected Publications
- 5 Forum Posts
- 6 External Links
- 7 References
There are various macro- and micro-iterations going on within a chess program and/or its creator, game controller and/or learning framework, i.e. the process to develop and tune a chess program, to repeat a series of games against various opponents for learning and automated tuning purpose, to iterate over moves while playing a game, Iterative Deepening, the move loop and current variation inside a minimax depth-first search, processing exchange sequences in SEE, looking for repetitions, generating moves of one piece and for all pieces, serializing bitboards, and whatever else.
Learning and automated tuning in computer chess programming deals with algorithms that allow the program to change its behavior based on data acquired during game play against variations of itself or a variety of opponents considering the final outcome and/or the game record. Evolutionary computation, genetic programming and simulated annealing apply iterative processes where one iteration deals with one generation of the chess or game playing program.
Playing a game of chess versus a chess program, is a sequential, iterative process. The next iteration either starts after the program played its move and starts pondering, or the user entered a move. The Game Loop terminates when the game is finished or aborted.
In the context of Iterative Deepening in search algorithms, an iteration refers the current call of the search routine with a certain search depth inside the loop body of the ID framework. The resulting sequence is a sequence of exact scores for subsequent incremented search depths.
The typical control structure inside a minimax depth-first search of a chess program is the Move Loop, a generator or iterator pattern traversing the moves of one node or position. The whole implementation details of move generation, move ordering, pruning, bookkeeping and accessing a move list, might be hidden behind an iterator object and its interface.
While the "horizontal" iteration of the move loop appears in one node, the "vertical" edges of the search tree, that is actually making the move and recursively calling the negamaxed search routine for the child node, appear in the current depth-first variation started at the root. It can be considered as nested iterations of the move loops processed in all upper nodes. Keeping an explicit stack of move iterators per node further allows to reformulate the recursive search routine as iterative solution, with makes it simpler to unwind the search.
Recursion to Iteration
Tail recursion is trivially convertible to iteration  , and performed by various optimizing compilers. Since a call as used in recursion is nothing else than a jump to an address, remembering the next instruction on the stack for the return, recursion can always replaced by iteration using an array as explicit stack, an index (stack pointer) for the current nesting level, and goto instructions, as demonstrated in Iterative Search. Knuth and Moore already introduced an iterative solution of Alpha-Beta in 1975  . Iterative solutions of otherwise recursive algorithms are harder to understand and to debug and tend to become Spaghetti code , but are required for certain parallel search algorithms like Dynamic Tree Splitting. There are jumps from inside the move loop body outside (call), and vice versa (return).
In computational mathematics, an iterative algorithm or method is a procedure that generates integer, fixed point, or floating point sequences and calculates Series. Iterative algorithms are used to approximate nonlinear equations  and to solve certain optimization problems. An iterative method is called convergent if the corresponding sequence converges for given initial approximations.
In computer chess, iterative algorithms are used for instance directly or indirectly in initializing Zobrist keys with Pseudorandom number generators (PRNG), for instance the linear congruential generator, the Mersenne twister, the Xorshift by George Marsaglia or the KISS approach by Bob Jenkins similar as used in Stockfish .
- Automated Tuning
- Backtracking - Eight Queens puzzle with Bitboards
- Bitboard Serialization
- Flood Fill Algorithms
- Internal Iterative Deepening
- Iterative Deepening
- Iterative Search
- Pseudorandom Number Generator
- Retrograde Analysis
- SEE - The Swap Algorithm
- Traversing Subsets of a Set
- Paul Stein (1987). Iteration of Maps, Strange Attractors, and Number Theory - An Ulamian Potpourri. in Stanislaw Ulam 1909-1984. Los Alamos Science, No. 15, pdf » Stanislaw Ulam
- Iteration from Wikipedia
- Iterative and incremental development from Wikipedia
- Recursion from Wikipedia
- Control flow: Loops from Wikipedia
- Inner loop from Wikipedia
- Idle loop from Wikipedia
- Spinlock loop from Wikipedia
- iterator - C++ Reference » C++
- Iterator (Java 2 Platform SE 5.0) » Java
- 3.5 Iterator Types - Python Library Reference » Python
- Arnoldi iteration from Wikipedia
- Bregman method from Wikipedia
- Euclidean algorithm from Wikipedia
- Fixed point iteration from Wikipedia
- Gauss–Newton algorithm from Wikipedia
- Gauss–Seidel method from Wikipedia
- Gradient descent from Wikipedia
- Hill climbing from Wikipedia
- Householder's method from Wikipedia
- Iterated local search from Wikipedia
- Jacobi eigenvalue algorithm from Wikipedia
- Jacobi Iteration for Eigenvectors
- Jacobi method
- Local search (optimization) from Wikipedia
- Newton's method from Wikipedia
- Newton's method in optimization
- Picard Iteration Revisited
- Power iteration from Wikipedia
- Rate of convergence from Wikipedia
- Root-finding algorithm from Wikipedia
- Simulated annealing from Wikipedia
- Subgradient method from Wikipedia
- Collatz conjecture from Wikipedia
- Fibonacci number from Wikipedia
- Integer sequence from Wikipedia
- Linear congruential generator from Wikipedia
- Recurrence relation from Wikipedia
- Arithmetic progression from Wikipedia
- Convergent series from Wikipedia
- Geometric series from Wikipedia
- Fourier series from Wikipedia
- Harmonic series from Wikipedia
- Taylor series from Wikipedia
- Iterationen from Strukturen in der Biologie (German)
- Recursion - Tail-recursive functions from Wikipedia,
- Replace Recursion with Iteration
- Donald Knuth, Ronald W. Moore (1975). An analysis of alpha-beta pruning. Artificial Intelligence, 6:293–326
- Considered harmful from Wikipedia
- Brian J. Shelburne (1999). Zuse's Z3 Square Root Algorithm. » Konrad Zuse
- RKISS copyright? by Giorgio Medeot, CCC, March 07, 2011