Pure function

A function whose output depends only on its arguments and that changes nothing outside itself.

Think of it as A calculator key: the same buttons always give the same answer.

Pure functions read no globals, touch no instances, never wait and never save. That makes them trivial to unit test. Game services keep the side effects and call pure rules for the decisions.

Related terms