#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct { char name[80]; float score; }topten[10]; char name2[80]; struct { int col; } colors[16]; struct dice { int die1; int die2; }; int rolled(dice pair); void animate_rolled(dice pair); void winlose(int &total, int bet, float &money); void load_ten(float &money); void draw_splash(); void slot(float &money); void craps(float &money); void clearbox(int add1); void spin(float &money, int bet); void payoff(int c1, int c2, int c3, float &money, int bet); void drawicons(int add1, int x); void hilist(float money); void prtten(); void wheel(float &money); void spinw(float &money, int bet, int &pay); void paintwheel(int col1, int x, int y); void gameend(); //CYAN= 3 //LIGHTBLUE= 9 //GREEN= 2 //MAGENTA= 5 void main() { cout.setf(ios::fixed); colors[1].col=5; colors[2].col=3; colors[3].col=9; colors[4].col=3; colors[5].col=2; colors[6].col=3; colors[7].col=9; colors[8].col=3; colors[9].col=2; colors[10].col=3; colors[11].col=9; colors[12].col=3; colors[13].col=9; colors[14].col=3; colors[15].col=9; colors[16].col=2; textcolor(5); clrscr(); float money=1000; int menus; int driver=VGA; int mode=VGAHI; initgraph(&driver, &mode, "\\TC\\BGI"); draw_splash(); load_ten(money); clrscr(); setbkcolor(BLUE); rectangle(1,1,640,480); setfillstyle(SOLID_FILL,BLUE); floodfill(5,5,BLUE); while(menus!=99) { cout<<"Welcome to Jared and Andrew's Casino Palace!"<>menus; switch(menus) { case 1: slot(money); break; case 2: craps(money); break; case 3: wheel(money); break; case 4: prtten(); break; case 99: break; default: cout<<"Please choose another option."; getch(); break; } clrscr(); setbkcolor(BLUE); rectangle(1,1,640,480); setfillstyle(SOLID_FILL,BLUE); floodfill(5,5,BLUE); if(money==0) { gameend(); break; } } hilist(money); getch(); } void draw_splash() { setbkcolor(GREEN); cout<<"Game Suite by Jared Bott and Andrew Martinez"; setcolor(BLUE); setfillstyle(SOLID_FILL, BLACK); //G rectangle(30, 50, 80, 180); rectangle(31, 51, 79, 179); rectangle(100, 135, 155, 145); rectangle(101, 136, 154, 144); rectangle(130, 150, 150, 200); rectangle(131, 151, 149, 199); //A rectangle(170, 55, 205, 185); rectangle(171, 56, 204, 184); rectangle(210, 120, 235, 137); rectangle(211,121,234,136); line(187,35,262,35); line(187,34,262,34); line(187,34,187,48); line(186,34,186,48); line(186,48,245,48); line(186,49,245,49); line(245,49,245,185); line(246,49,246,185); line(262,35,262,185); line(263,35,263,185); line(263,185,246,185); line(263,184,246,184); //M rectangle(280,120,310,185); rectangle(279,119,309,184); rectangle(320,100,335,130); rectangle(321,101,336,131); rectangle(340,100,380,100); rectangle(340,101,380,101); rectangle(380,100,380,185); rectangle(379,100,379,185); rectangle(380,185,360,185); rectangle(380,184,360,184); rectangle(360,185,360,120); rectangle(361,185,361,120); rectangle(360,120,340,120); rectangle(360,119,340,119); rectangle(340,119,340,100); rectangle(341,119,341,100); //E rectangle(390,35,460,65); rectangle(391,36,459,64); rectangle(390,104,430,124); rectangle(391,105,429,123); rectangle(390,165,475,185); rectangle(391,166,474,184); //S line(494,50,584,50); line(494,51,584,51); line(494,51,494,71); line(495,51,495,71); line(494,71,554,71); line(494,70,554,70); line(554,70,554,78); line(555,70,555,78); line(554,78,584,78); line(554,77,584,77); line(584,78,584,50); line(583,78,583,50); //Center of S line(493,87,507,83); line(494,88,506,84); line(493,87,564,158); line(494,88,565,157); line(507,83,578,154); line(506,84,577,153); line(564,158,578,154); line(565,157,577,153); line(494,185,584,185); line(494,184,584,184); line(584,185,584,165); line(583,185,583,165); line(584,165,524,165); line(584,166,524,166); line(524,165,524,158); line(523,165,523,158); line(524,158,494,158); line(524,159,494,159); line(494,158,494,185); line(495,158,495,185); //Coin setcolor(BLUE); circle(320,330,100); setfillstyle(SOLID_FILL,YELLOW); floodfill(320,330,BLUE); setcolor(BLUE); circle(320,330,70); rectangle(280,290,300,370); line (262, 355, 274, 355); line (274, 355, 274, 359); line (274, 359, 278, 359); line (278, 359, 278, 370); line (278, 370, 262, 370); line (262, 370, 262, 355); rectangle(320,290,340,370); rectangle(342,290,355,300); rectangle(357,300,362,370); rectangle(342,320,355,330); getch(); } void load_ten(float &money) { char temp[80]; int x=0; ifstream thefile; thefile.open("a:topten.txt",ios::in); while(!thefile.eof()) { thefile.getline(topten[x].name,80); thefile.getline(temp,80); topten[x].score=atof(temp); x++; } thefile.close(); getch(); clrscr(); setcolor(BLUE); textbackground(BLUE); setbkcolor(BLUE); rectangle(1,1,640,480); setfillstyle(SOLID_FILL,BLUE); floodfill(5,5,BLUE); cout<<"What is your name?"<>bet; if(bet>money) { r=1; gotoxy(1,24); cout<<"You don't have enough."; cin>>bet; clrscr(); setbkcolor(BROWN); rectangle(1,1,640,480); setfillstyle(SOLID_FILL,BROWN); floodfill(5,5,BROWN); for(d=1;d<=25;d++) { delline(); } } if(r==1) { setbkcolor(BROWN); setcolor(DARKGRAY); line(0,0,120,100); line(120,100,520,100); line(520,100,640,0); line(120,100,120,380); line(120,380,520,380); line(520,380,520,100); line(120,380,0,480); line(520,380,640,480); line(120,193,520,193); line(120,286,520,286); setfillstyle(SOLID_FILL,DARKGRAY); floodfill(480,1,DARKGRAY); setfillstyle(SOLID_FILL,RED); floodfill(480,478,DARKGRAY); setcolor(YELLOW); rectangle(210,263,215,285); rectangle(217,276,222,285); rectangle(224,210,235,285); rectangle(360,210,390,220); rectangle(360,222,368,285); rectangle(370,242,375,247); rectangle(379,222,388,285); setcolor(DARKGRAY); line(640,150,520,193); line(580,193,580,295); line(580,295,520,295); line(640,320,580,295); line(640,370,520,295); line(520,193,580,193); line(580,193,640,175); setfillstyle(CLOSE_DOT_FILL,BLUE); floodfill(540,320,DARKGRAY); setfillstyle(SOLID_FILL,BLUE); floodfill(639,321,DARKGRAY); setcolor(GREEN); rectangle(224,296,388,346); setfillstyle(SOLID_FILL,GREEN); floodfill(225,297,GREEN); setcolor(DARKGRAY); rectangle(226,346,246,406); rectangle(366,346,386,406); setfillstyle(SOLID_FILL,DARKGRAY); floodfill(227,347,DARKGRAY); floodfill(367,347,DARKGRAY); floodfill(227,381,DARKGRAY); floodfill(367,381,DARKGRAY); rectangle(100,450,200,455); rectangle(250,450,350,455); rectangle(400,450,500,455); floodfill(101,451,DARKGRAY); floodfill(251,451,DARKGRAY); floodfill(401,451,DARKGRAY); setcolor(GREEN); line(60,450,105,410); line(105,410,105,350); line(105,350,60,350); line(60,350,60,450); setfillstyle(SOLID_FILL,GREEN); floodfill(61,351,GREEN); setcolor(MAGENTA); setfillstyle(SOLID_FILL,MAGENTA); fillellipse(70,300,60,95); setcolor(BLUE); setfillstyle(SOLID_FILL,BLUE); fillellipse(610,270,10,15); rectangle(590,285,630,330); floodfill(591,286,BLUE); getch(); } switch(bet) { case 1: break; case 5: break; case 10: break; case 0: break; default: cout<topten[x].score) { cout<<"Congratulations! You made it to the top 10 list!"<>bet; if(bet>money) { gotoxy(1,24); cout<<"You don't have enough."; cin>>bet; clrscr(); setbkcolor(BLUE); rectangle(1,1,640,480); setfillstyle(SOLID_FILL,BLUE); floodfill(5,5,BLUE); } money-=bet; if(bet==0) { break; } spinw(money,bet,pay); cout<<"You made $"<>bet; clrscr(); setbkcolor(BLUE); rectangle(1,1,640,480); setfillstyle(SOLID_FILL,BLUE); floodfill(5,5,BLUE); goto comenzar; } clrscr(); setbkcolor(BLUE); rectangle(1,1,640,480); setfillstyle(SOLID_FILL,BLUE); floodfill(5,5,BLUE); setcolor(YELLOW); circle(320,240,200); line(290,37,318,37); line(290,37,304,55); line(318,37,304,55); setfillstyle(SOLID_FILL,YELLOW); floodfill(296,42,YELLOW); floodfill(296,38,YELLOW); setcolor(YELLOW); line(320,240,320,440); line(320,240,320,40); line(320,240,120,240); line(320,240,520,240); line(320,240,(320-(200/3)),51); line(320,240,(320-(400/3)),90); line(320,240,(320-183),160); line(320,240,(320+(200/3)),51); line(320,240,(320+(400/3)),90); line(320,240,(320+183),160); line(320,240,(320-(550/3)),319); line(320,240,(320-(400/3)),390); line(320,240,(320-81),422); line(320,240,(320+(550/3)),319); line(320,240,(320+(400/3)),390); line(320,240,(320+85),420); int x,col1; int number; int temp; randomize(); number=random(34)+16; for(x=1;x<=number;x++) { int y; for(y=1;y<=16;y++) { col1=colors[y].col; paintwheel(col1,x,y); } delay(10*(x+(x/5))); temp=colors[1].col; colors[1].col=colors[2].col; colors[2].col=colors[3].col; colors[3].col=colors[4].col; colors[4].col=colors[5].col; colors[5].col=colors[6].col; colors[6].col=colors[7].col; colors[7].col=colors[8].col; colors[8].col=colors[9].col; colors[9].col=colors[10].col; colors[10].col=colors[11].col; colors[11].col=colors[12].col; colors[12].col=colors[13].col; colors[13].col=colors[14].col; colors[14].col=colors[15].col; colors[15].col=colors[16].col; colors[16].col=temp; } pay=0; if(bflag==1 && colors[16].col==11) { pay=bet * 2; } else if (bflag==2 && colors[16].col==4) { pay=bet * 4; } else if (bflag==3 && colors[16].col==2) { pay= bet * 8; } else if (bflag==4 && colors[16].col==5) { pay=800; } else { pay=0; } } void paintwheel(int col1, int x, int y) { if (y==1) { setfillstyle(SOLID_FILL,col1); floodfill(319,230,YELLOW); } else if (y==2) { setfillstyle(SOLID_FILL,col1); floodfill(321,230,YELLOW); } else if (y==16) { setfillstyle(SOLID_FILL,col1); floodfill(315,230,YELLOW); } else if (y==3) { setfillstyle(SOLID_FILL,col1); floodfill(325,230,YELLOW); } else if (y==15) { setfillstyle(SOLID_FILL,col1); floodfill(302,230,YELLOW); } else if(y==4) { setfillstyle(SOLID_FILL,col1); floodfill(340,230,YELLOW); } else if(y==14) { setfillstyle(SOLID_FILL,col1); floodfill(292,230,YELLOW); } else if(y==5) { setfillstyle(SOLID_FILL,col1); floodfill(361,230,YELLOW); } else if(y==10) { setfillstyle(SOLID_FILL,col1); floodfill(319,250,YELLOW); } else if (y==9) { setfillstyle(SOLID_FILL,col1); floodfill(321,250,YELLOW); } else if (y==11) { setfillstyle(SOLID_FILL,col1); floodfill(312,250,YELLOW); } else if(y==7) { setfillstyle(SOLID_FILL,col1); floodfill(339,250,YELLOW); } else if (y==12) { setfillstyle(SOLID_FILL,col1); floodfill(302,250,YELLOW); } else if (y==6) { setfillstyle(SOLID_FILL,col1); floodfill(361,250,YELLOW); } else if (y==13) { setfillstyle(SOLID_FILL,col1); floodfill(292,250,YELLOW); } else if(y==8) { setfillstyle(SOLID_FILL,col1); floodfill(361,290,YELLOW); } } void gameend() { settextstyle(GOTHIC_FONT,HORIZ_DIR,9); setcolor(3); outtextxy(10,2,"GAME OVER"); getch(); exit(1); } //Main function for craps void craps(float &money) { //Randomize for dice rollings randomize(); //Clears the screen clrscr(); //Variables char qr[5]; int bet=0; int total=0; int x=1; int d; dice pair; //Graphics initialization setbkcolor(YELLOW); //Keeps the player playing until they quit. while (strcmpi(qr, "Q")!=0) { setcolor(YELLOW); //Clears the screen for (x=1; x<=640; x++) { line (x, 1, x, 480); } total=0; gotoxy(1, 1); cout<<"Press 'R' to Roll, 'Q' to Quit"<>qr; if (strcmpi(qr, "R")==0) { cout<<"Chips: $1, $5, $10, $20"<>bet; if(bet>money) { gotoxy(1,24); cout<<"You don't have enough."; cin>>bet; clrscr(); setbkcolor(YELLOW); rectangle(1,1,640,480); setfillstyle(SOLID_FILL,YELLOW); floodfill(5,5,YELLOW); for(d=1;d<=25;d++) { delline(); } } switch (bet) { case 1: setcolor(RED); rectangle(75, 150, 275, 350); rectangle(300, 150, 500, 350); setfillstyle(SOLID_FILL, RED); floodfill(76, 151, RED); floodfill(301, 151, RED); total=0; animate_rolled(pair); total=rolled(pair); break; case 5: setcolor(RED); rectangle(75, 150, 275, 350); rectangle(300, 150, 500, 350); setfillstyle(SOLID_FILL, RED); floodfill(76, 151, RED); floodfill(301, 151, RED); total=0; animate_rolled(pair); total=rolled(pair); break; case 10: setcolor(RED); rectangle(75, 150, 275, 350); rectangle(300, 150, 500, 350); setfillstyle(SOLID_FILL, RED); floodfill(76, 151, RED); floodfill(301, 151, RED); total=0; animate_rolled(pair); total=rolled(pair); break; case 20: setcolor(RED); rectangle(75, 150, 275, 350); rectangle(300, 150, 500, 350); setfillstyle(SOLID_FILL, RED); floodfill(76, 151, RED); floodfill(301, 151, RED); total=0; animate_rolled(pair); total=rolled(pair); break; default: cout<<"The casino employee tells you that they do not accept Canadian money."<