Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in C++ to construct and plot a 2-D square grid of dimension L X L where L can vary from five to

image text in transcribed

Write a program in C++ to construct and plot a 2-D square grid of dimension L X L where L can vary from five to twenty-five. Use a class to hold the grid data. The grid squares either hold the user's player " P ", the target " T ", or is empty. The player's goal is to reach the target by moving either left, right, up, or down. Players move one grid square each tum and the target moves in a random direction either zero (50% likely) or one ( 50% likely) grid square each tum. The target is constrained to not move to the same square as the player if within one square's distance. A running score showing the player's name and running total number of moves at each tum should be displayed over the grid at each turn. 1. Use extended characters for the square grid 2. input player moves using keyboard keys without carriage returns 3. code should have error checking for incorrect key entries

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

Database Systems On GPUs In Databases

Authors: Johns Paul ,Shengliang Lu ,Bingsheng He

1st Edition

1680838482, 978-1680838480

More Books

Students also viewed these Databases questions

Question

Do cost overruns just happen, or are they caused?

Answered: 1 week ago

Question

What is the name of this compound? H3C CI `CH3

Answered: 1 week ago