Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have a code a puzzle game, I am sharing the code below, I need you to add some features to make the game more

I have a code a puzzle game, I am sharing the code below, I need you to add some features to make the game more interesting and advance. please add features(e.g timer countdown 60 sec, moves counter and limit and more features) in the code and explain them as well. you can use your own images and audios in the code , just mention those parts so I can make changes as per my needs, please answer in the form of code I have project submission tomorrow and its urgent. #include
#include
#include
#define SIZE 10
#define CELL_SIZE 50
#define BOARD_SIZE (SIZE * CELL_SIZE)
// Function to draw the board on the screen
void drawBoard(int numbers[]){
cleardevice();
setbkcolor(YELLOW);
settextstyle(BOLD_FONT, HORIZ_DIR, 2);
for (int i =0; i < SIZE; i++){
char buffer[3];
sprintf(buffer,"%d", numbers[i]);
rectangle(i * CELL_SIZE, 0,(i +1)* CELL_SIZE, CELL_SIZE);
outtextxy(i * CELL_SIZE + CELL_SIZE /2-10, CELL_SIZE /2-10, buffer);
}
settextstyle(2,0,4);
readimagefile("electrodesplace.jpg",20,60,120,200);
outtextxy(30,230,"electrodes =2");
readimagefile("rightlegdriver.jpg",150,60,250,200);
outtextxy(160,230,"right leg driver=5");
readimagefile("highpassfil.jpg",280,60,380,200);
outtextxy(290,230,"high pass filter=7");
readimagefile("patient.jpg",410,60,510,200);
outtextxy(420,230,"patient =1");
readimagefile("waveform.jpg",540,60,640,200);
outtextxy(550,230," waveform =10");
readimagefile("output.jpg",20,250,120,390);
outtextxy(30,410," hardware pc interface=9");
readimagefile("isolationamp.jpg",150,250,250,390);
outtextxy(160,410," isolation amplifier=6");
readimagefile("leadsel.jpg",280,250,380,390);
outtextxy(290,410," lead selection =3");
readimagefile("lowpassfil.jpg",410,250,510,390);
outtextxy(420,410," low pass filter=8");
readimagefile("instrumentationamp.jpg",540,250,640,390);
outtextxy(550,410,"instrumentation amplifier=4");
getch();
}
// Function to check if the board is in the correct order
bool checkBoard(int numbers[]){
for (int i =0; i < SIZE; i++){
if (numbers[i]!= i +1){
return false;
}
}
return true;
}
int main(){
initwindow(1200,600," signal acquiring game ");
outtextxy(201,300,"Biomedical Engineering games presents");
outtextxy(230,360,"Body Signal Acquisition Game");
readimagefile("Biomedicalengineering.jpg",50,200,200,400);
getch();
cleardevice();
setcolor(RED);
settextstyle(10,0,2);
outtextxy(200,200," LOADING ...");
rectangle(200,250,400,270);
for(int i=1; i<200;i++)
{ setcolor(GREEN);
rectangle(202,251,199+i,269);
delay(50);
}
cleardevice();
getch();
settextstyle(10,0,3);
outtextxy(500,250, "Introduction");
outtextxy(50,300,"This game is designed for biomedical engineers to test and refresh their knowledge");
outtextxy(95,360," of basic building structure of machines that acquire body signals ");
outtextxy(95,420,"Press enter key to continue...");
getch();
cleardevice();
settextstyle(10,0,2);
outtextxy(500,250, "Instructions ");
outtextxy(50,300,"1. Each component of the machine has been assigned a numeric value");
outtextxy(50,330,"2. The user has to arrange the numbers according to the ordered placement of components");
outtextxy(50,360,"3.click the number you want to swap ");
outtextxy(50,390,"4. Only when you have placed the components in correct order the game will terminate");
outtextxy(300,420,"Press enter key to continue...");
getch();
int numbers[SIZE]={5,2,8,4,1,7,10,9,3,6};
bool gameWon = false;
while (!gameWon){
drawBoard(numbers);
int input = getch()-'0';
// Find the index of the input number
int index =-1;
for (int i =0; i < SIZE; i++){
if (numbers[i]== input){
index = i;
break;
}
}
// Swap the input number with the adjacent number on the board
if (index >0 && numbers[index -1]> numbers[index]){
std::swap(numbers[index], numbers[index -1]);
} else if (index < SIZE -1 && numbers[index +1]> numbers[index]){
std::swap(numbers[index], numbers[index +1]);
}
// Check if the board is in the correct order
if (checkBoard(numbers)){
gameWon = true;
}
}
cleardevice();
setcolor(RED);
settextstyle(BOLD_FONT, HORIZ_DIR, 3);
outtextxy(70,200, "Congratulations! You know your way around EEG,ECG,EMG machines.");
getch();
closegraph();
return 0;
}

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

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

LO3.3 Describe supply and explain how it can change.

Answered: 1 week ago

Question

LO3.1 Characterize and give examples of markets.

Answered: 1 week ago