• 俄罗斯方块

    import java.awt.*; import java.awt.event.*; @SuppressWarnings("serial") class ERS_Block extends Frame { public static boolean isPlay=false; public static int level=1,score=0; public static TextField scoreField,levelField; public static MyTimer timer; GameCanvas gameScr; @SuppressWarnings("deprecation") ERS_Block(String title){

    0
    54
    3KB
    2012-12-11
    1
  • 思瑞平斯基三角形

    #include <graphics.h> #include <conio.h> #include <stdio.h> #include <string.h> #include <math.h> int q; float AX,AY,BX,BY,CX,CY,DX,DY; double XX[1001],YY[1001]; void getin() {printf("input point ax and ay:\n"); scanf("%f %f",&AX;,&AY;); printf("input point bx and by:\n"); scanf("%f %f",&BX;,&BY;); printf("input point cx and cy:\n"); scanf("%f %f",&CX;,&CY;); printf("input point dx and dy:\n"); scanf("%f %f",&DX;,&DY;); } void putout(int a) {int driver,mode; int m; driver=VGA; mode=VGAMED; registerbgidriver(EGAVGA_driver); initgraph(&driver;,&mode;,"c:\tc"); setcolor(YELLOW); line(AX,AY,BX,BY); line(BX,BY,CX,CY); line(CX,CY,DX,DY); setcolor(BLUE); for(m=0;m<a-2;m++) line(XX[m],YY[m],XX[m+1],YY[m+1]); } void main() { int a; float T,TT; float x[4],y[4]; double t[4],sub1[4]; int m[4][4]={{-1,3,-3,1},{3,-6,3,0},{-3,0,3,0},{1,4,1,0}}; int i,j,k; M:printf("input a number from 50--1000:\n"); scanf("%d",&a); getin(); TT=1/(a*1.0); x[0]=AX;x[1]=BX;x[2]=CX;x[3]=DX; y[0]=AY;y[1]=BY;y[2]=CY;y[3]=DY; for(j=0,T=TT;j<a;j++,T=j*TT) { t[0]=T*T*T;t[1]=T*T;t[2]=T;t[3]=1; sub1[0]=0;sub1[1]=0;sub1[2]=0;sub1[3]=0; { for(i=0;i<=3;i++) for (k=0;k<=3;k++) sub1[i]+=t[k]*m[k][i]; } for(k=0;k<=3;k++) { XX[j]+=sub1[k]*x[k]/6.0; YY[j]+=sub1[k]*y[k] /6.0; } } putout(a); /*scanf("%d",&q); if(q) goto M;*/ system&#40;"pause"&#41;;

    0
    133
    1KB
    2012-12-11
    16
关注 私信
上传资源赚积分or赚钱