/* * ListJosephus: * This class implements a Josephus circle using an STL List * N : initial number of players * M : interval to jump for next removal */ #ifndef LISTJOSEPHINE_H #define LISTJOSEPHINE_H #include #include #include "Person.h" class ListJosephus { public: // Constructors: // Provide a default empty circle constructor ListJosephus(); // - a constructor that initializes the circle with N people who // will play this game // - position values should be system assigned in the order of insertion // for example, if N=5, then the people in the circle should be // assigned positions: 0,1,2,3,4. ListJosephus(int N,int M); // Destructor: ~ListJosephus(); // Public methods: // this does the same thing as the 1-argument constructor above init(int N,int M); // makes the circle empty clear(); // prints the number of people in the circle int currentSize(); // returns true if circle is empty bool isEmpty(); // eliminates the next person as per the game's rule Person eliminateNext(); // prints the current content of circle in sequence starting from the person with the least position number void printAll(); // any other member functions of your choice // .... private: list circle; int size; // dynamic size of circle; initially size=N int M; // any other variables of your choice // .... }; #endif