(Solved) : Ve Trying Complete Jumping Puzzle Game Objective Puzzle Reach 3 Pieces 2 Colors Red Blue O Q42774208 . . .

I’ve been trying to complete this jumping puzzle game where theobjective of the puzzle is to reach 3 pieces of each 2 colors (redand blue) on the opposite side of where they start. There is onlytwo directions in this game, those being left and right. I’ve beenusing the layout of the commonly known Sliding Tile Puzzle Game butam struggling on where to go from the example down below.

#pragma warning(disable:4996)
#include               // for general IO
#include
using namespace std;
#include               // for getche()
#include
#include
#define SLIDE_LEFT       1     
#define SLIDE_RIGHT      2  
char theBoard[7];
int main() {
   char input;
   bool invalid = false;
   void setNewBoard(char theBoard[7]);
   bool moveByIndex(char theBoard[7], intslideDirection);
   bool isSolved(char theBoard[7]);
   void isGimped(char theBoard[7]);
   void DrawBoard(char theBoard[7]);
   char jumpingBoard[7];

   while (!isSolved(theBoard))
   {
       input = _getch();
       system(“CLS”);
       switch (toupper(input))
       {
       case ‘A’:
          moveByIndex(jumpingBoard, 1);
           break;
       case ‘D’:
          moveByIndex(jumpingBoard, 2);
           break;
       default:
           invalid =true;
       }

       bool moveByIndex(chartheBoard[7], int slideDirection)
       {
           int emptyRow =0;
           boollegalMoves[2] = { 1,1 };
           for (int row =0; row <= 7; row++)
           {
                  if (theBoard[row] == 0)
                  {
                      emptyRow =row;
                  }
           }
           if (emptyRow + 1> 2) //Can i move up?
              legalMoves[2] = false; //If no, set tofalse
           else if(emptyRow – 1 < 0) //Down?
              legalMoves[3] = false;

           switch(slideDirection)
           {
           case 2:
              if (legalMoves[slideDirection])
              {
                  theBoard[emptyRow] =theBoard[emptyRow];
                  theBoard[emptyRow] = 0;
              }
              break;
           case 1:
              if (legalMoves[slideDirection])
              {
                  theBoard[emptyRow] =theBoard[emptyRow];
                  theBoard[emptyRow] = 0;
              }
              break;
           }
       }
       void DrawBoard(chartheBoard[7])
       {
           int i = 1;
           for (int row =0; row++)
           {
                  theBoard[row] = i;
                  solvedBoard[row] = i;
                  i++;
              }
              theBoard[2][2] = 0;
              solvedBoard[2][2] = 0;
           }
       void isGimped(chartheBoard[7])
       {
          srand(time(NULL));
           intslideDirection;
           while(isSolved(theBoard))
           {
              for (int i = 0; i < 9000; i++)
              {
                  slideDirection = rand() %5;
                  moveByIndex(theBoard,slideDirection);
              }
           }
       }
       bool isSolved(intamISolved[7])
       {
           intsolvedBoard[7] = { 1,2,3,0,5,6,7 };
       }
  

Expert Answer


Answer to I’ve been trying to complete this jumping puzzle game where the objective of the puzzle is to reach 3 pieces of each 2 c…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?