Class SquidIterators.CenteredSquare

java.lang.Object
squidpony.squidgrid.iterator.SquidIterators.CenteredSquare
All Implemented Interfaces:
Iterator<Coord>, SquidIterator
Enclosing class:
SquidIterators

public static class SquidIterators.CenteredSquare
extends Object
implements SquidIterator
An iterator that returns cells in a square around a location. Cells are iterated from bottom left to top right in this square. A square size of 0 creates an iterator that returns one location (the starting one); a square of size 1 is an iterator that returns at most 9 locations, (start.x-1,start.y+1), (start.x,start.y+1), ...; a square of size 2 returns at most ((2*2)+1)*((2*2)+1) = 25 locations, etc..

Instances of this iterator never return a coordinate outside the map.

Author:
smelC