/*********************************************************** Copyright 2003 Rick Miller - Pulp Free Press This source code accompanies the text C++ For Artists and is provided for instructional purposes only. No warranty concerning the quality of the code is expressed or implied. You are free to use this code in your programs so long as this copyright notice is included in its entirety. **********************************************************/ #include "rodentworld.h" #include "robotrat.h" RodentWorld::RodentWorld(int rows, int columns):its_rows(rows),its_columns(columns), number_of_rodents(1), rodent_number(0){ rodent_array = new AbstractControlledRodent*[number_of_rodents]; rodent_array[0] = new RobotRat(its_rows, its_columns); } RodentWorld::~RodentWorld(){ for(int i = 0; iturnLeft(); } void RodentWorld::turnRodentRight(){ rodent_array[rodent_number]->turnRight(); } void RodentWorld::moveRodent(int spaces){ rodent_array[rodent_number]->move(spaces); } void RodentWorld::setRodentTailUp(){ rodent_array[rodent_number]->setTailUp(); } void RodentWorld::setRodentTailDown(){ rodent_array[rodent_number]->setTailDown(); } char* RodentWorld::getRodentType(){ return rodent_array[rodent_number]->getObjectType(); } bool RodentWorld::isRodentTailDown(){ return rodent_array[rodent_number]->isMarkerDown(); } int RodentWorld::getRodentRow(){ return rodent_array[rodent_number]->getRow(); } int RodentWorld::getRodentColumn(){ return rodent_array[rodent_number]->getColumn(); }