Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

making a grid world that is 5X5 and being able to give every id a special number and doing the functions in the following, even

making a grid world that is 5X5 and being able to give every id a special number and doing the functions in the following, even if not all the functions just some of the first ones will be a great help because i dont even know how to start this, we have to buit it in c++ if there is any questions i can help to help thorugh this let me know i want to understand this but i have no idea what i dont understand to start with. #ifndef _GRID_WORLD_H #define _GRID_WORLD_H #include  #include  using std::vector; class GridWorld { private: // private stuff goes here! // typedefs // data members // private helper functions // etc. public: /** * constructor: initializes a "world" with nrows and * ncols (nrows*ncols districtcs) in which all * districtricts are empty (a wasteland!). */ GridWorld(unsigned nrows, unsigned ncols) { // your constructor code here! } ~GridWorld(){ // your destructor code here. } /* * function: birth * description: if row/col is valid, a new person is created * with an ID according to rules in handout. New person is * placed in district (row, col) * * return: indicates success/failure */ bool birth(int row, int col, int &id){ return false; } /* * function: death * description: if given person is alive, person is killed and * data structures updated to reflect this change. * * return: indicates success/failure */ bool death(int personID){ return false; } /* * function: whereis * description: if given person is alive, his/her current residence * is reported via reference parameters row and col. * * return: indicates success/failure */ bool whereis(int id, int &row, int &col)const{ return false; } /* * function: move * description: if given person is alive, and specified target-row * and column are valid, person is moved to specified district and * data structures updated accordingly. * * return: indicates success/failure * * comment/note: the specified person becomes the 'newest' member * of target district (least seniority) -- see requirements of members(). */ bool move(int id, int targetRow, int targetCol){ return false; } std::vector * members(int row, int col)const{ return nullptr; } /* * function: population * description: returns the current (living) population of the world. */ int population()const{ return 0; } /* * function: population(int,int) * description: returns the current (living) population of specified * district. If district does not exist, zero is returned */ int population(int row, int col)const{ return 0; } /* * function: num_rows * description: returns number of rows in world */ int num_rows()const { return 0; } /* * function: num_cols * description: returns number of columns in world */ int num_cols()const { return 0; } }; #endif

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago