Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need to program a game where the same letters such as 'G' or 'Y' move together (see example of first three moves down below). Once

Need to program a game where the same letters such as 'G' or 'Y' move together (see example of first three moves down below). Once the "RR" gets all the way to the right, where the 'Y''s position is, the game is over. I'm trying to figure out how to move the pieces. I'm not allowed to use strings, vectors, or arrays, so I was wondering how to do this without using them. Rows do not have to move up or down, and columns do not have to move side to side, only up and down. For example, "FFF" only has to move side to side, not up where the "TT" is. The same goes for "BBB" or "YYY", they do not have to move left or right, only up and down. However, this must work on multiple boards. The user is allowed to change the board (see second board) and the letters are not allowed to overwrite each other (example: "RR" cannot land on "B", the letters must land on an empty space, a period ".") . I have already created the board, and I know how to receive input from the user to change the board, but I don't know how to move the letters as one without using arrays/vectors/strings. I appreciate the help!

EDIT - When I was writing this question the board was all lined up, but after it was posted it got all funny looking. Assume the letters and everything are all lined up into a nice looking board. I'm not sure why it is posting different than how it appears when I type it out.

PROGRAMMING LANGUAGE: C++

- - - - - - - |G G . . . Y| |P . . B . Y| |P R R B . Y |P . . B . .| |O . . . T T| |O . F F F .| - - - - - - - 1. Your move -> gr1 (g = 'G', r = right, 1 = one space) 
- - - - - - - |. G G . . Y| |P . . B . Y| |P R R B . Y |P . . B . .| |O . . . T T| |O . F F F .| - - - - - - - 2. Your move -> pu1 (p = 'P', u = up, 1 = one space) - - - - - - - |P G G . . Y| |P . . B . Y| |P R R B . Y |. . . B . .| |O . . . T T| |O . F F F .| - - - - - - - 3. Your move -> OU2 *** Move was attempted, but couldn't be completed. *** 

(BELOW IS A DIFFERENT BOARD EXAMPLE SELECTED BY USER)

- - - - - - - |G O T T P R| |G O . . P G| |Y R R E . S |Y W W E . S| |Y . L U U U| |N N L B B B| - - - - - - - 

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

More Books

Students also viewed these Databases questions