/*作者 victor*/
/*编程爱好者请加QQ329399853 附言:编程粉丝,大家有时间多交流呀*/
#include<iostream.h>
#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<bios.h>
#include<stdlib.h>
#include<math.h>
#define VK_LEFT 0x4b00 /*上下左右键的值*/
#define VK_RIGHT 0x4d00
#define VK_DOWN 0x5000
#define VK_UP 0x4800
#define VK_ESC 0x011b
#define VK_SPACE 0x3920
#define TRUE 1
#define FALSE 0
#define PI 3.141593
#define sqrt2 1.41421
#define y1 17.32051
int flag;
circle1(int x,int y,float r)
{int i;
for(i=1;i<r;i++)
{circle(x,y,i);
}
return 0;
}
class bubble{
public:
float x,y;
int color;
float radius;
int samecolor;
int clear_init;
int notdrop;
int drop_init;
}board[114];
void initboard() /*******************************************************************/
{int i,j,k;
for(i=0;i<114;i++)
{board[i].y=i/19*2*y1+10+(i%19)/10*y1;
if((i%19)/10==0)board[i].x=(i%19)*20+10;
if((i%19)/10==1)board[i].x=(i%19)%10*20+20;
board[i].samecolor=FALSE;
board[i].clear_init=FALSE;
board[i].notdrop=FALSE;
board[i].drop_init=FALSE;
}
}
class startbub{
public:
float x,y;
float x2,y2;
int color;
float v; /*bubble运动的速度*/
float radius;
float angle;
float moveangle;
startbub()
{x=100.0;y=10.0+12*y1;angle=PI/2.0;moveangle=PI/2.0;v=1.0;}
MakeBubble();
ShowAngle();
MoveBubble();
ChangeAngle();
ClearBubble();
DropBubble();
}bub;
initbub()
{
bub.x=100;
bub.y=10+12*y1;
return 0;
}
printboard() /********************************************************/
{int i;
for(i=0;i<114;i++)
{if(board[i].color!=0)
{setcolor(board[i].color);
circle1(board[i].x,board[i].y,10);
setfillstyle(SOLID_FILL,board[i].color);
bar(board[i].x-sqrt2*4.4,board[i].y-sqrt2*4.4,board[i].x+sqrt2*4.4,board[i].y+sqrt2*4.4);
}
else {setcolor(BLACK);
circle1(board[i].x,board[i].y,10);
setfillstyle(SOLID_FILL,BLACK);
bar(board[i].x-sqrt2*4.4,board[i].y-sqrt2*4.4,board[i].x+sqrt2*4.4,board[i].y+sqrt2*4.4);
}
}
return 0;
}
startbub::MakeBubble() /***************************************************************/
{
color=random(6)+1;
return 0;
}
startbub::ShowAngle() /****************************************************************/
{setcolor(BLACK);
setlinestyle(SOLID_LINE,10,10);
line(100.0,10+12*y1,x2,y2);
x2=100.0+30.0*cos(angle);
y2=10+12*y1-30.0*sin(angle);
setcolor(8);
line(100.0,10+12*y1,x2,y2);
setcolor(color);
circle1(100.0,10+12*y1,10);
return 0;
}
printbub()
{
setcolor(bub.color);
circle1(bub.x,bub.y,10);
bar(bub.x-sqrt2*5.0,bub.y-sqrt2*5.0,bub.x+sqrt2*5.0,bub.y+sqrt2*5.0);
bub.ShowAngle();
return 0;
}
clearbub()
{
setcolor(BLACK);
circle1(bub.x,bub.y,10);
bar(bub.x-sqrt2*5.0,bub.y-sqrt2*5.0,bub.x+sqrt2*5.0,bub.y+sqrt2*5.0);
bub.ShowAngle();
return 0;
}
int startbub::MoveBubble() /****************************************************************/
{int i,j;
int flag1;
flag=0;
/*编程爱好者请加QQ329399853 附言:编程粉丝,大家有时间多交流呀*/
#include<iostream.h>
#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<bios.h>
#include<stdlib.h>
#include<math.h>
#define VK_LEFT 0x4b00 /*上下左右键的值*/
#define VK_RIGHT 0x4d00
#define VK_DOWN 0x5000
#define VK_UP 0x4800
#define VK_ESC 0x011b
#define VK_SPACE 0x3920
#define TRUE 1
#define FALSE 0
#define PI 3.141593
#define sqrt2 1.41421
#define y1 17.32051
int flag;
circle1(int x,int y,float r)
{int i;
for(i=1;i<r;i++)
{circle(x,y,i);
}
return 0;
}
class bubble{
public:
float x,y;
int color;
float radius;
int samecolor;
int clear_init;
int notdrop;
int drop_init;
}board[114];
void initboard() /*******************************************************************/
{int i,j,k;
for(i=0;i<114;i++)
{board[i].y=i/19*2*y1+10+(i%19)/10*y1;
if((i%19)/10==0)board[i].x=(i%19)*20+10;
if((i%19)/10==1)board[i].x=(i%19)%10*20+20;
board[i].samecolor=FALSE;
board[i].clear_init=FALSE;
board[i].notdrop=FALSE;
board[i].drop_init=FALSE;
}
}
class startbub{
public:
float x,y;
float x2,y2;
int color;
float v; /*bubble运动的速度*/
float radius;
float angle;
float moveangle;
startbub()
{x=100.0;y=10.0+12*y1;angle=PI/2.0;moveangle=PI/2.0;v=1.0;}
MakeBubble();
ShowAngle();
MoveBubble();
ChangeAngle();
ClearBubble();
DropBubble();
}bub;
initbub()
{
bub.x=100;
bub.y=10+12*y1;
return 0;
}
printboard() /********************************************************/
{int i;
for(i=0;i<114;i++)
{if(board[i].color!=0)
{setcolor(board[i].color);
circle1(board[i].x,board[i].y,10);
setfillstyle(SOLID_FILL,board[i].color);
bar(board[i].x-sqrt2*4.4,board[i].y-sqrt2*4.4,board[i].x+sqrt2*4.4,board[i].y+sqrt2*4.4);
}
else {setcolor(BLACK);
circle1(board[i].x,board[i].y,10);
setfillstyle(SOLID_FILL,BLACK);
bar(board[i].x-sqrt2*4.4,board[i].y-sqrt2*4.4,board[i].x+sqrt2*4.4,board[i].y+sqrt2*4.4);
}
}
return 0;
}
startbub::MakeBubble() /***************************************************************/
{
color=random(6)+1;
return 0;
}
startbub::ShowAngle() /****************************************************************/
{setcolor(BLACK);
setlinestyle(SOLID_LINE,10,10);
line(100.0,10+12*y1,x2,y2);
x2=100.0+30.0*cos(angle);
y2=10+12*y1-30.0*sin(angle);
setcolor(8);
line(100.0,10+12*y1,x2,y2);
setcolor(color);
circle1(100.0,10+12*y1,10);
return 0;
}
printbub()
{
setcolor(bub.color);
circle1(bub.x,bub.y,10);
bar(bub.x-sqrt2*5.0,bub.y-sqrt2*5.0,bub.x+sqrt2*5.0,bub.y+sqrt2*5.0);
bub.ShowAngle();
return 0;
}
clearbub()
{
setcolor(BLACK);
circle1(bub.x,bub.y,10);
bar(bub.x-sqrt2*5.0,bub.y-sqrt2*5.0,bub.x+sqrt2*5.0,bub.y+sqrt2*5.0);
bub.ShowAngle();
return 0;
}
int startbub::MoveBubble() /****************************************************************/
{int i,j;
int flag1;
flag=0;