#ifndef RANDOMLY_H #define RANDOMLY_H #include //for the rand function #include "wabbit.h" //This class is named "randomly" because the C++ Standard Library already //contains something named "random". class randomly: public virtual wabbit { public: randomly(const terminal& init_t, unsigned init_x, unsigned init_y, char init_c): wabbit {init_t, init_x, init_y, init_c} { } void decide(int *dx, int *dy) const { //The values of *dx and *dy are either -1, 0, or 1. *dx = rand() % 3 - 1; *dy = rand() % 3 - 1; } }; #endif