// randomly.h #ifndef RANDOMLY_H #define RANDOMLY_H #include #include "wabbit.h" class randomly : virtual public wabbit { public: randomly(const terminal& t, unsigned init_x, unsigned init_y, char c) : wabbit(t, init_x, init_y, c) {} void move() override { int dx = rand() % 3 - 1; int dy = rand() % 3 - 1; x += dx; y += dy; term.put(x, y, icon); } }; #endif