ผลยังไม่ออกดี เป็นเพราะไม่ใช่ TC2 ตัวเต็ม รึเปล่า ? ขอใครก็ได้แต่ที่แคร็กมาแล้ว ใครมีแผ่นรวมโปรแกรม tool complilers ดีๆ แจกไหมครับ ขอซื้อเลยก็ได้ครับ
ส่วนโค้ดซีนั้นดังนี้
#if defined(__STDC__) && defined(USE_HAGGIS_PRAGMA)
#pragma(HAGGIS)
#endif
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<dos.h>
#include<math.h>
/*
#define MAXX 640
#define MAXY 480
#define MINX 1
#define MINY 1
*/
int MAXX=640,MAXY=480,MINX=1,MINY=1;
int *tempx=0,*tempy=0;
typedef unsigned char BYTE;
/* int i=0,N=0; */
float zeta[9];
BYTE Ball[] = { /* bitmap silver ball */
15, 13,
0, 0, 0, 0, 10,11, 11, 11, 11, 11, 10, 0, 0, 0, 0,
0, 0, 10, 12, 13, 14, 13, 13, 13, 14, 14, 12, 10, 0, 0,
0, 11, 12, 14, 14, 15, 16, 16, 14, 13, 12, 13, 12, 10, 0,
10, 12, 14, 16, 18, 20, 21, 21, 18, 14, 11, 11, 13, 12, 0,
12, 14, 15, 18, 21, 21, 21, 19, 15, 11, 8, 9, 11, 14, 11,
12, 14, 16, 19, 20, 19, 18, 15, 11, 9, 8, 8, 11, 15, 12,
13, 14, 15, 17, 18, 16, 14, 11, 9, 8, 8, 9, 11, 15, 13,
12, 14, 14, 14, 13, 11, 9, 8, 7, 7, 8, 10, 13, 15, 13,
12, 12, 12, 9, 8, 7, 7, 8, 9, 10, 12, 14, 14, 12,
10, 12, 12, 9, 9, 8, 9, 9, 10, 12, 13, 15, 15, 13, 10,
0, 11, 12, 13, 13, 13, 14, 15, 15, 14, 11, 0,
0, 0, 11, 12, 13, 13, 13, 14, 15, 14, 14, 12, 10, 0, 0,
0, 0, 0, 10, 10, 11, 11, 12, 12, 11, 11, 0, 0,
};
struct Ballk1 {
BYTE imBall[191];
float x[9];
float y[9];
float vect[9];
float size[2];
float angle[2];
} Ballks[9];
int main() {
int i=0,j=0,k=0,N=0;
int addx=0,addy=0;
/* struct Ballk1 Ballks[9]; */
addx=1;
addy=1;
clrscr();
printf("Phongphan Porana ID: 39111940");
printf("Enter Number of Ball: 1-10 : ");
scanf("%d",&N);
for(i=1; i<N ;i++){
zeta=0;
Ballks.x[0]=0;
Ballks.y=0;
Ballks.vect=0;
for(k=0; k<3 ;k++){
Ballks.size[k]=0;
Ballks.angle[k]=0;
}
}
for(i=1; i < N ;i++) {
j=0;
zeta=(random(360));
zeta*=6.28/360.0;
Ballks.x[j]=((random(MAXX)+MINX)/MAXX);
Ballks.y=((random(MAXY)+MINY)/MAXY);
*tempx = MAXX;
*tempy = MAXY;
MAXX = MINX;
MAXY = MINY;
Ballks.vect = floor(fmod(pow(Ballks.x[j]*cos(zeta),2),MAXX*MAXX) + fmod(pow(Ballks.y*sin(zeta),2),MAXY*MAXY))/(0.00001+sqrt(fmod\
(pow(Ballks.x[j]*cos(zeta),2),MAXX*MAXX) + fmod(pow(Ballks.y*sin(zeta),2),20*MAXY)));
Ballks.vect = (Ballks.vect/((10.0*10.0+10.0*10.0)+(10.0+10.0)))/sqrt((10.0*10.0)+(10.0*10.0));
/* Ballks.vect = (Ballks.vect*((10*10+10*10)+(10+10)))/sqrt((10*10)+(10*10)); */
Ballks.size = floor(sqrt(fmod(Ballks.vect,sqrt(fmod(pow(Ballks.x[j]*cos(zeta),2),MAXX*MAXX) + \
fmod(pow(Ballks.y*sin(zeta),2),MAXY*MAXY)))));
Ballks.angle = -floor(atan((Ballks.vect*sin(zeta))/(Ballks.vect*cos(zeta))));
MAXX = *tempx;
MAXY = *tempy;
Ballks.x[j]*=MAXX;
Ballks.y*=MAXY;
Ballks.size[0]=Ballks.size;
Ballks.angle[0]=Ballks.angle;
for(j=0; j<3 ; j++){
k = fmod(j,3);
Ballks.size[k] = Ballks.size[j]+1.0;
Ballks.angle[k] = -abs(Ballks.angle[j]+1.0);
Ballks.x[j] = Ballks.size[k]*cos(Ballks.angle[k]);
Ballks.y[j] = Ballks.size[k]*sin(Ballks.angle[k]);
}
/*
for(j=0; j<191 ; j++){
Ballks.imBall[j]=Ball[j];
}
*/
}
do {
j=0;
for(i=1; i < N ;i++){
if (Ballks.x[j] > MINX && Ballks.y<=MINY) {
zeta+=4.71;
Ballks.x[i+2] > Ballks.x[i+1] ? Ballks.x[j]++ : Ballks.x[j]--;
Ballks.y=Ballks.y + !addy;
} else
if (Ballks.x[j]>=MAXX && Ballks.y<=MAXY) {
zeta+=4.71;
Ballks.x[j]=Ballks.x[j] + !addx;
Ballks.y[i+2] > Ballks.y[i+1] ? Ballks.y++: Ballks.y--;
} else
if (Ballks.x[j]>MINX && Ballks.y>=MAXY) {
zeta+=4.71;
Ballks.x[i+1] > Ballks.x[i+2] ? Ballks.x[j]-- : Ballks.x[j]++;
Ballks.y=Ballks.y - !addy;
} else
if (Ballks.x[j]<=MINX && Ballks.y>MINY) {
zeta+=4.71;
Ballks.x[j]=Ballks.x[j] - !addx;
Ballks.y[i+1] > Ballks.y[i+2] ? Ballks.y-- : Ballks.y++;
}
Ballks.x[j]+=addx;
Ballks.y+=addy;
Ballks.x[j]/=MAXX;
Ballks.y/=MAXY;
for(i=1; i<N ;i++){
Ballks.vect=0;
for(k=0; k<3 ;k++){
Ballks.size[k]=0;
Ballks.angle[k]=0;
}
}
*tempx = MAXX;
*tempy = MAXY;
MAXX = MINX;
MAXY = MINY;
Ballks.vect = floor(fmod(pow(Ballks.x[j]*cos(zeta),2),MAXX*MAXX) + fmod(pow(Ballks.y*sin(zeta),2),MAXY*MAXY))/(0.00001+sqrt(fmod\
(pow(Ballks.x[j]*cos(zeta),2),MAXX*MAXX) + fmod(pow(Ballks.y*sin(zeta),2),20*MAXY)));
Ballks.vect = (Ballks.vect/((10.0*10.0+10.0*10.0)+(10.0+10.0)))/sqrt((10.0*10.0)+(10.0*10.0));
/* Ballks.vect = (Ballks.vect*((10*10+10*10)+(10+10)))/sqrt((10*10)+(10*10)); */
Ballks.x[j]*=MAXX;
Ballks.y*=MAXY;
Ballks.size = floor(sqrt(fmod(Ballks.vect,sqrt(fmod(pow(Ballks.x[j]*cos(zeta),2),MAXX*MAXX) + \
fmod(pow(Ballks.y*sin(zeta),2),MAXY*MAXY)))));
Ballks.angle = -floor(atan((Ballks.vect*sin(zeta))/(Ballks.vect*cos(zeta))));
MAXX = *tempx;
MAXY = *tempy;
Ballks.size[0]=Ballks.size;
Ballks.angle[0]=Ballks.angle;
for(j=0; j<3 ; j++){
k = fmod(j,3);
Ballks.size[k] = Ballks.size[j]+1.0;
Ballks.angle[k] = -abs(Ballks.angle[j]+1.0);
Ballks.x[j] = Ballks.size[k]*cos(Ballks.angle[k]);
Ballks.y[j] = Ballks.size[k]*sin(Ballks.angle[k]);
}
printf(" %e \n",Ballks[1].y[1]);
/* printf("%d \n",Ballks.y);
printf("%d \n",Ballks.vect);
}
move(&Ballks.x[j],&Ballks.y,&Ballks.imBall); */
}
}
while (kbhit() == 0);
getch();
return 0;
}
มีโค้ดภาษาซีมาให้ช่วยตรวจดูด้วยครับ
ส่วนโค้ดซีนั้นดังนี้
#if defined(__STDC__) && defined(USE_HAGGIS_PRAGMA)
#pragma(HAGGIS)
#endif
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<dos.h>
#include<math.h>
/*
#define MAXX 640
#define MAXY 480
#define MINX 1
#define MINY 1
*/
int MAXX=640,MAXY=480,MINX=1,MINY=1;
int *tempx=0,*tempy=0;
typedef unsigned char BYTE;
/* int i=0,N=0; */
float zeta[9];
BYTE Ball[] = { /* bitmap silver ball */
15, 13,
0, 0, 0, 0, 10,11, 11, 11, 11, 11, 10, 0, 0, 0, 0,
0, 0, 10, 12, 13, 14, 13, 13, 13, 14, 14, 12, 10, 0, 0,
0, 11, 12, 14, 14, 15, 16, 16, 14, 13, 12, 13, 12, 10, 0,
10, 12, 14, 16, 18, 20, 21, 21, 18, 14, 11, 11, 13, 12, 0,
12, 14, 15, 18, 21, 21, 21, 19, 15, 11, 8, 9, 11, 14, 11,
12, 14, 16, 19, 20, 19, 18, 15, 11, 9, 8, 8, 11, 15, 12,
13, 14, 15, 17, 18, 16, 14, 11, 9, 8, 8, 9, 11, 15, 13,
12, 14, 14, 14, 13, 11, 9, 8, 7, 7, 8, 10, 13, 15, 13,
12, 12, 12, 9, 8, 7, 7, 8, 9, 10, 12, 14, 14, 12,
10, 12, 12, 9, 9, 8, 9, 9, 10, 12, 13, 15, 15, 13, 10,
0, 11, 12, 13, 13, 13, 14, 15, 15, 14, 11, 0,
0, 0, 11, 12, 13, 13, 13, 14, 15, 14, 14, 12, 10, 0, 0,
0, 0, 0, 10, 10, 11, 11, 12, 12, 11, 11, 0, 0,
};
struct Ballk1 {
BYTE imBall[191];
float x[9];
float y[9];
float vect[9];
float size[2];
float angle[2];
} Ballks[9];
int main() {
int i=0,j=0,k=0,N=0;
int addx=0,addy=0;
/* struct Ballk1 Ballks[9]; */
addx=1;
addy=1;
clrscr();
printf("Phongphan Porana ID: 39111940");
printf("Enter Number of Ball: 1-10 : ");
scanf("%d",&N);
for(i=1; i<N ;i++){
zeta=0;
Ballks.x[0]=0;
Ballks.y=0;
Ballks.vect=0;
for(k=0; k<3 ;k++){
Ballks.size[k]=0;
Ballks.angle[k]=0;
}
}
for(i=1; i < N ;i++) {
j=0;
zeta=(random(360));
zeta*=6.28/360.0;
Ballks.x[j]=((random(MAXX)+MINX)/MAXX);
Ballks.y=((random(MAXY)+MINY)/MAXY);
*tempx = MAXX;
*tempy = MAXY;
MAXX = MINX;
MAXY = MINY;
Ballks.vect = floor(fmod(pow(Ballks.x[j]*cos(zeta),2),MAXX*MAXX) + fmod(pow(Ballks.y*sin(zeta),2),MAXY*MAXY))/(0.00001+sqrt(fmod\
(pow(Ballks.x[j]*cos(zeta),2),MAXX*MAXX) + fmod(pow(Ballks.y*sin(zeta),2),20*MAXY)));
Ballks.vect = (Ballks.vect/((10.0*10.0+10.0*10.0)+(10.0+10.0)))/sqrt((10.0*10.0)+(10.0*10.0));
/* Ballks.vect = (Ballks.vect*((10*10+10*10)+(10+10)))/sqrt((10*10)+(10*10)); */
Ballks.size = floor(sqrt(fmod(Ballks.vect,sqrt(fmod(pow(Ballks.x[j]*cos(zeta),2),MAXX*MAXX) + \
fmod(pow(Ballks.y*sin(zeta),2),MAXY*MAXY)))));
Ballks.angle = -floor(atan((Ballks.vect*sin(zeta))/(Ballks.vect*cos(zeta))));
MAXX = *tempx;
MAXY = *tempy;
Ballks.x[j]*=MAXX;
Ballks.y*=MAXY;
Ballks.size[0]=Ballks.size;
Ballks.angle[0]=Ballks.angle;
for(j=0; j<3 ; j++){
k = fmod(j,3);
Ballks.size[k] = Ballks.size[j]+1.0;
Ballks.angle[k] = -abs(Ballks.angle[j]+1.0);
Ballks.x[j] = Ballks.size[k]*cos(Ballks.angle[k]);
Ballks.y[j] = Ballks.size[k]*sin(Ballks.angle[k]);
}
/*
for(j=0; j<191 ; j++){
Ballks.imBall[j]=Ball[j];
}
*/
}
do {
j=0;
for(i=1; i < N ;i++){
if (Ballks.x[j] > MINX && Ballks.y<=MINY) {
zeta+=4.71;
Ballks.x[i+2] > Ballks.x[i+1] ? Ballks.x[j]++ : Ballks.x[j]--;
Ballks.y=Ballks.y + !addy;
} else
if (Ballks.x[j]>=MAXX && Ballks.y<=MAXY) {
zeta+=4.71;
Ballks.x[j]=Ballks.x[j] + !addx;
Ballks.y[i+2] > Ballks.y[i+1] ? Ballks.y++: Ballks.y--;
} else
if (Ballks.x[j]>MINX && Ballks.y>=MAXY) {
zeta+=4.71;
Ballks.x[i+1] > Ballks.x[i+2] ? Ballks.x[j]-- : Ballks.x[j]++;
Ballks.y=Ballks.y - !addy;
} else
if (Ballks.x[j]<=MINX && Ballks.y>MINY) {
zeta+=4.71;
Ballks.x[j]=Ballks.x[j] - !addx;
Ballks.y[i+1] > Ballks.y[i+2] ? Ballks.y-- : Ballks.y++;
}
Ballks.x[j]+=addx;
Ballks.y+=addy;
Ballks.x[j]/=MAXX;
Ballks.y/=MAXY;
for(i=1; i<N ;i++){
Ballks.vect=0;
for(k=0; k<3 ;k++){
Ballks.size[k]=0;
Ballks.angle[k]=0;
}
}
*tempx = MAXX;
*tempy = MAXY;
MAXX = MINX;
MAXY = MINY;
Ballks.vect = floor(fmod(pow(Ballks.x[j]*cos(zeta),2),MAXX*MAXX) + fmod(pow(Ballks.y*sin(zeta),2),MAXY*MAXY))/(0.00001+sqrt(fmod\
(pow(Ballks.x[j]*cos(zeta),2),MAXX*MAXX) + fmod(pow(Ballks.y*sin(zeta),2),20*MAXY)));
Ballks.vect = (Ballks.vect/((10.0*10.0+10.0*10.0)+(10.0+10.0)))/sqrt((10.0*10.0)+(10.0*10.0));
/* Ballks.vect = (Ballks.vect*((10*10+10*10)+(10+10)))/sqrt((10*10)+(10*10)); */
Ballks.x[j]*=MAXX;
Ballks.y*=MAXY;
Ballks.size = floor(sqrt(fmod(Ballks.vect,sqrt(fmod(pow(Ballks.x[j]*cos(zeta),2),MAXX*MAXX) + \
fmod(pow(Ballks.y*sin(zeta),2),MAXY*MAXY)))));
Ballks.angle = -floor(atan((Ballks.vect*sin(zeta))/(Ballks.vect*cos(zeta))));
MAXX = *tempx;
MAXY = *tempy;
Ballks.size[0]=Ballks.size;
Ballks.angle[0]=Ballks.angle;
for(j=0; j<3 ; j++){
k = fmod(j,3);
Ballks.size[k] = Ballks.size[j]+1.0;
Ballks.angle[k] = -abs(Ballks.angle[j]+1.0);
Ballks.x[j] = Ballks.size[k]*cos(Ballks.angle[k]);
Ballks.y[j] = Ballks.size[k]*sin(Ballks.angle[k]);
}
printf(" %e \n",Ballks[1].y[1]);
/* printf("%d \n",Ballks.y);
printf("%d \n",Ballks.vect);
}
move(&Ballks.x[j],&Ballks.y,&Ballks.imBall); */
}
}
while (kbhit() == 0);
getch();
return 0;
}