Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started