A spatial Gillespie simulator and corresponding cellular automata