/* ISU test project */ #include #include #include #include #include #include #include #include #include #define VGA256 0x13 #define TEXT 0x03 char far *videoBuffer = (char far *) 0xA0000000L; void setMode (int mode) { asm { mov ax, mode int 0x10 } } void putPixel (int x, int y, int color) { videoBuffer [((y<<8) + (y<<6)) + x] = (unsigned char) color; } void colorScr (int color) { _fmemset (videoBuffer, color, 64000L); } void Line (int x1, int y1, int x2, int y2, int color); void Oval(int x0, int y0, int a, int b, int color); int main () { clrscr (); int gdriver = DETECT, gmode, errorcode; initgraph (&gdriver, &gmode, "c:\\turboc\\bgi"); errorcode = graphresult (); if (errorcode != grOk) { printf ("Graphics error: %s \n", grapherrormsg (errorcode)); printf ("Press Anykey to halt: "); getch (); exit (1); } setMode (VGA256); //setMode (TEXT); //int numplayers, go=1; /* player name [player number] [player name] */ //char *playername[3]; //, player2name[20], player3name[20]; //int player[3] = {0,0,0}; //, player2[3], player3[3]; //printf("\n\n\n\t\t\tWHEEL OF FORTUNE"); //getch(); colorScr(112); //outtextxy(1,20,"WHEEL OF FORTUNE"); printf("\n\n\n\t WHEEL OF FORTUNE"); //getch(); Line(20,70,20,180,15); Line(20,180,300,180,15); Line(300,180,300,70,15); Line(300,70,20,70,15); Line(60,80,60,150,15); Line(60,80,260,80,15); Line(260,80,260,150,15); Oval(160,150,30,30,15); /* while (go != 0) { clrscr(); printf("\n\n\nHow many players do you want. (1 - 3)? "); scanf("%d", &numplayers); numplayers -= 1; fflush(stdin); if (numplayers == 0) { printf("\nENTER in you name player1.\n"); gets(playername[0]); playername[1] = " "; playername[2] = " "; //printf("\n%s", player1name); printf("\nLets start the game!"); getch(); go = 0; } else if (numplayers == 1) { printf("\nENTER in you name player1.\n"); gets(playername[0]); printf("\nENTER in you name player2.\n"); gets(playername[1]); playername[3] = " "; printf("\nLets start the game!"); getch(); go = 0; } else if (numplayers == 2) { printf("\nENTER in you name player1.\n"); gets(playername[0]); printf("\nENTER in you name player2.\n"); gets(playername[1]); printf("\nENTER in you name player3.\n"); gets(playername[2]); printf("\nLets start the game!"); getch(); go = 0; } else { printf("That is incorrect!"); getch(); go = 1; } } fflush(stdin); randomize(); int strt; strt = random(numplayers); */ // clrscr(); // printf("\n%s starts.", playername[strt]); // getch(); //int what,spin,pnum; //score=0,score2=0,score3=0, //char phrase[] = {"CAN I BUY A VOWEL"}; //, "WHEEL OF FORTUNE", "GAME SHOW HOST"}; //char phrase[] = "CAN I BUY A VOWEL"; //char phrase[] = "WHEEL OF FORTUNE"; //char phrase[] = "GAME SHOW HOST"; //pnum = random(2); //char phrase[] = phrase[]; //char answer[sizeof(phrase)] = {" "}; //, " ", " "}; //char answer[sizeof(phrase1)] = " "; //char answer[sizeof(phrase2)] = " "; //char answer[sizeof(phrase3)] = " "; //int goes=1,flag=0,flag2=0,numletters=0; // while (goes != 0) // { /* for (int a=0; a 0) { clrscr(); printf("\nThere are only vowels left."); getch(); } if (flag == sizeof(phrase)) { clrscr(); printf("\n\n\n"); printf("\nCongradgulations, You won!"); if (player[strt] < 250) { player[strt] = 250; printf("\n%s get $ %d.", playername[strt], player[strt]); getch(); } else { printf("\n%s score is $ %d.", playername[strt], player[strt]); getch(); } printf("\nThanks for playing.\nBye Bye!"); getch(); return 0; } */ // clrscr(); // printf("\n%s's turn.", playername[strt]); // printf("\nYour score is %d.", player[strt]); // printf("\n\n1. Spin\n2. Buy a Vowel\n3. Solve\n4. Exit"); // printf("\n\nEnter in a number. "); // scanf("%d", &what); // fflush(stdin); /* if (what == 1) { randomize(); printf ("\n"); //score += Spin((char *)phrase, (char *)answer); clrscr(); int amount,strength; char bankrupt[] = "BANKRUPT"; char jackpot[] = "JACKPOT"; go = 1; while (go != 0) { clrscr(); printf("\nPower 1 - 10."); printf("\nHow much power would you like to spin the wheel? "); scanf("%d", &strength); fflush(stdin); if (strength < 1 || strength > 10) { printf("\nThat is incorrect."); getch(); } else { go = 0; } } strength *= 2; clrscr(); for (int a=0; a= 1) { if (num == 1) { printf("\nThere is %d %c.", num, letter); } else if (num > 1) { printf("\nThere are %d %c's.", num, letter); } player[strt] += amount; } printf("\n%s", answer); //printf("\nYour score is %d.", score); getch(); flag=0; for(a=0; a= 250) { player[strt] -= 250; //Vowel((char *)phrase, (char *)answer); clrscr(); char vowel; printf("\n%s score is %d.", playername[strt], player[strt]); printf("\n%s", answer); printf("\n\nENTER in a vowel. "); scanf("%c", &vowel); fflush(stdin); int num=0,flag=0; if (vowel == 'A' || vowel == 'E' || vowel == 'I' || vowel == 'O' || vowel == 'U') { for (int a=0; a<18; a++) { if (vowel == *answer[pnum][a]) { printf("\nThat vowel has already been used."); if (strt == 2) strt = 0; else if (numplayers == 0) strt = 0; else if (numplayers == 1) { if (strt == 2) strt = 0; else strt += 1; } else strt += 1; break; } else if (vowel == *phrase[pnum][a]) { *answer[pnum][a] = vowel; num+=1; } else { flag+=1; } } } else { printf("\nThat is not a vowel."); getch(); if (strt == 2) strt = 0; else if (numplayers == 0) strt = 0; else if (numplayers == 1) { if (strt == 2) strt = 0; else strt += 1; } else strt += 1; //return 0; } if (num > 0) { if (num == 1) { printf("\nThere is %d %c.", num, vowel); //getch(); } else if (num > 1) { printf("\nThere are %d %c's.", num, vowel); //getch(); } } if (flag >= 18) { printf("\nSorry, no %c's.", vowel); if (strt == 2) strt = 0; else if (numplayers == 0) strt = 0; else if (numplayers == 1) { if (strt == 2) strt = 0; else strt += 1; } else strt += 1; } printf("\n%s ", answer); getch(); flag=0; for(int a=0; a=0) { xInc = 1; } else { xInc = -1; dx = -dx; } if (dy>=0) { yInc = 320; } else { yInc = -320; dy = -dy; } if (dx>dy) { for (i=0; i<=dx; i++) { *vBptr = color; error += dy; if (error>dx) { error -= dx; vBptr += yInc; } vBptr += xInc; } } else { for (i=0; i<=dy; i++) { *vBptr = color; error += dx; if (error>0) { error -= dy; vBptr += xInc; } vBptr += yInc; } } } void Oval(int x0, int y0, int a, int b, int color) { int x, y; // midpoint algorithm is a long aSquared, twoAsquared; // variation on Bresenham long bSquared, twoBsquared; long d, dx, dy; x = 0; y = b; aSquared = a * a; twoAsquared = 2 * aSquared; bSquared = b * b; twoBsquared = 2 * bSquared; // initial excess distance d d = bSquared - aSquared * b + aSquared / 4L; dx = 0; // initial run and rise dy = twoAsquared * b; // magnitudes dx and dy while (dx < dy) { // slow slope > -1 putPixel(x0+x, y0+y, color); putPixel(x0+x, y0-y, color); putPixel(x0-x, y0+y, color); putPixel(x0-x, y0-y, color); if (d > 0) { // midpoint is outside --y; // go down one line dy -= twoAsquared; d -= dy; ++x; dx += twoBsquared; d += bSquared + dx; } else { ++x; // midpoint is inside dx += twoBsquared; d += bSquared + dx; } } // reset d for fast slope d += (3L * (aSquared - bSquared) / 2L - (dx + dy)) / 2L; while (y >= 0) { // fast slope < -1 putPixel(x0+x, y0+y, color); putPixel(x0+x, y0-y, color); putPixel(x0-x, y0+y, color); putPixel(x0-x, y0-y, color); if (d < 0) { // midpoint is outside ++x; dx += twoBsquared; d += dx; } --y; // midpoint is inside dy -= twoAsquared; d += aSquared - dy; } }