Java implementation of the classic game