diff --git a/c.c b/c.c index 6771942..d16e9d5 100644 --- a/c.c +++ b/c.c @@ -1,7 +1,8 @@ #include -main() +int main() { printf("Hello World"); - -} \ No newline at end of file + printf("Sachin is smart.") + return 0; +} diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..4ac6aa0 Binary files /dev/null and b/icon.png differ diff --git a/index.html b/index.html index a6e534c..c16807a 100644 --- a/index.html +++ b/index.html @@ -1,3 +1,137 @@ +<<<<<<< HEAD + + + + The experiment + + +======= @@ -8,3 +142,4 @@

When you fix the segfault

+>>>>>>> icechen1/master diff --git a/tambola.c b/tambola.c new file mode 100644 index 0000000..8a6eede --- /dev/null +++ b/tambola.c @@ -0,0 +1,79 @@ +/* +A rudimentary tambola game that plays itself. +*/ + +#include +#include +#include + +void reprint(); +int tic1[10]; +int tic2[10]; +int i=0,j=0; +void main() +{ +int x=0,n=0,p1=0,p2=0,a=0,p=0,done[100]; +srand(time(NULL)); + +while(1) +{ + n++; + done[p]=0;} +clrscr(); +for(j=0;j<100;j=j+10) + { + tic1[i]=((rand())%10)+j; + tic2[i]=((rand())%10)+j; + i++; + } +reprint(); + +for(n=0;n<100;n++) +{ + x=rand()%100; + done[x]=1; + printf("\n\nNUMBER : %d",x); + for(a=0;a<10;a++) + { + if(x==tic1[a]) + { + p1++; + printf("\nP1 has %d.",x); + delay(500); + } + if(x==tic2[a]) + { + p2++; + printf("\nP2 has %d.",x); + delay(500); + } + } + printf("\n"); + for(p=0;p<100;p++) {if (done[p]) printf("%d ",p); + if(p1==10) {printf("\nP1 WINS!!!");getch();exit(0);} + if(p2==10) {printf("\nP2 WINS!!!");getch();exit(0);} + } + delay(200);reprint(); +} +getch(); +} + + +/* reprint */ + + +void reprint() +{ +clrscr(); +printf("\nPlayer 1 : "); +for(i=0;i<10;i++) + { + printf("%d ",tic1[i]); + } + +printf("\nPlayer 2 : "); +for(i=0;i<10;i++) + { + printf("%d ",tic2[i]); + } +}