/* DIXSA */ /*
DIXSA
Project experience
Date: May 14, 2007
Place: Sullia (D.K) This is lisence free code but, I request for anybody using this piece of code to not to change the name of the project "DIXSA" since that has some special purpose in my personal view. "DIXSA" is my B.E. 6th semester "COMPUTER GRAPHICS LABORATORY Part-B" project work. This is written in C-language. It is possible to run this program on 'TURBO C' platform on WINDOWS operating system. The reason behind this game idea is an old game (LUDO like game) named "CHOWKA-BHARA" which I learnt from my grandmother by name "LILAVATHI". Hence I feel very happy to dedicate this project work on my grandmothers' name. It's easy to understand the game procedure. The game is built in such a way that user will have real experience while playing with the system. No external speakers are needed to run this software as it make use of CPU inbuilt speakers. The limitations of this game are sound effect produced is not compatible with C++, because of 'delay ( )' used for system sounds; and hence it's not easily portable with other links as well as other platforms. And another vital drawback is some of the imperfections in the design like display aberrance of user pawns movement which will be clear only after clicking on 'PLAY' button, & many others. I felt very happy to take up this project & enjoyed doing this game design up to the maximum extent. There are a lot of rules that could be implemented as per the instructions of my grandmother. However, I could implement a small portion of them. My project guide "Mr. Rajashekhar K advaith" helped me for coding am thankful to him a lot. I'm also thankful to my SKDB hostel mates who have helped me to develop a beautiful design for this project. By,
Raghu S */
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h> void initilize_arrays();
void draw();
void sample_draw();
void show_help(int random);
void introduce();
void give_rules();
int initmouse();
void hidemouseptr();
void showmouseptr();
void getmouseptr();
void firstdraw();
void drawp1();
void drawp2();
int finish();
int generate();
int select(int random);
int invalid(int sel,int random);
int invalid_comp(int sel,int random);
void draw_cavde(int random);
int can_play(int mx,int my,int random);
int getpon(int mx,int my,int random); union REGS i,o;
int maxx,maxy,p=0,q=0,box[25][10];
int player1[4]={0,0,0,0},player2[4]={0,0,0,0};
int p1[25]={2,1,0,5,10,15,20,21,22,23,24,19,14,9,4,3,8,13,18,17,16,11,6,7,12};
int p2[25]={22,23,24,19,14,9,4,3,2,1,0,5,10,15,20,21,16,11,6,7,8,13,18,17,12};
int ext[10],play[10],help[10],xp,yp; void main()
{
int gd=DETECT,gm,flag=1;
int a,b,c,d,i,j,k,x,y,xi,yi,button,random; initgraph(&gd,&gm,"c:\\tc\\bgi"); maxx=getmaxx();
maxy=getmaxy(); if(initmouse()==0)
{
printf("Mouse driver not loaded");
getch();
closegraph();
restorecrtmode();
exit(1);
} introduce(); initilize_arrays(); a=maxx/16;
b=maxx*3/4;
c=maxy/16;
d=maxy*3/4; xi=(b-a)/5;
yi=(d-c)/5; for(y=c;y<d;y+=yi)
for(x=a;x<b;x+=xi)
{
box[p][q++]=x;
box[p][q++]=y;
box[p][q++]=x+xi;
box[p][q++]=y;
box[p][q++]=x+xi;
box[p][q++]=y+yi;
box[p][q++]=x;
box[p][q++]=y+yi;
box[p][q++]=x;
box[p][q++]=y;
p++;
q=0;
} draw(); showmouseptr(); j=-1;
while(j==-1)
{
getmouseptr();
j=can_play(xp,yp,0);
} random=generate(); while(!finish())
{
draw_cavde(random); if(flag)
{
flag=0;
for(k=0;k<4 && invalid(k,random);k++);
if(k==4)
{
hidemouseptr();
setcolor(WHITE);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,2);
outtextxy(ext[0]-50,100,"No");
outtextxy(ext[0]-50,130,"PAWN move");
outtextxy(ext[0]-50,160,"for YOU"); sleep(1); setcolor(BLACK);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,2);
outtextxy(ext[0]-50,100,"No");
outtextxy(ext[0]-50,130,"PAWN move");
outtextxy(ext[0]-50,160,"for YOU");
showmouseptr();
}
else
{
j=-1;
while(j==-1)
{
getmouseptr();
j=getpon(xp,yp,random);
}
player2[j]+=random;
if(player2[j]!=4 && player2[j]!=8 && player2[j]!=12 && player2[j]!=24)
for(k=0;k<4;k++)
if(p2[player2[j]]==p1[player1[k]])
player1[k]=0;
}
random=generate();
}
else
{
flag=1;
for(k=0;k<4 && invalid_comp(k,random);k++);
if(k==4)
{
hidemouseptr();
setcolor(WHITE);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,2);
outtextxy(ext[0]-50,100,"No");
outtextxy(ext[0]-50,130,"PAWN move");
outtextxy(ext[0]-50,160,"for ME"); sleep(1); setcolor(BLACK);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,2);
outtextxy(ext[0]-50,100,"No");
outtextxy(ext[0]-50,130,"PAWN move");
outtextxy(ext[0]-50,160,"for ME");
showmouseptr();
}
else
{
j=select(random);
player1[j]+=random; if(player1[j]!=4 && player1[j]!=8 && player1[j]!=12 && player1[j]!=24)
for(k=0;k<4;k++)
if(p2[player2[k]]==p1[player1[j]])
player2[k]=0;
}
random=generate();
j=-1;
while(j==-1)
{
getmouseptr();
j=can_play(xp,yp,random);
}
} hidemouseptr();
firstdraw();
drawp1();
drawp2();
showmouseptr();
} delay(100000);
getmouseptr();
hidemouseptr();
closegraph();
restorecrtmode();
} int initmouse()
{
i.x.ax=0;
int86(0x33,&i,&o);
return(o.x.ax);
} void showmouseptr()
{
i.x.ax=1;
int86(0x33,&i,&o);
} void hidemouseptr()
{
i.x.ax=2;
int86(0x33,&i,&o);
} void getmouseptr()
{
int b=-1;
while(b!=1)
{
i.x.ax=3;
int86(0x33,&i,&o);
b=o.x.bx;
}
xp=o.x.cx;
yp=o.x.dx;
} void initilize_arrays()
{
ext[0]=maxx-100;
ext[1]=20;
ext[2]=maxx-85;
ext[3]=20;
ext[4]=maxx-85;
ext[5]=35;
ext[6]=maxx-100;
ext[7]=35;
ext[8]=maxx-100;
ext[9]=20; play[0]=maxx-130;
play[1]=maxy-150;
play[2]=play[0]+50;
play[3]=play[1];
play[4]=play[0]+50;
play[5]=play[1]+20;
play[6]=play[0];
play[7]=play[1]+20;
play[8]=play[0];
play[9]=play[1]; help[0]=play[0];
help[1]=ext[1]+50;
help[2]=help[0]+50;
help[3]=help[1];
help[4]=help[0]+50;
help[5]=help[1]+20;
help[6]=help[0];
help[7]=help[1]+20;
help[8]=help[0];
help[9]=help[1];
} void draw()
{
setbkcolor(RED);
setcolor(WHITE);
setfillstyle(SOLID_FILL,BROWN);
fillpoly(5,ext);
line(maxx-100,20,maxx-85,35);
line(maxx-85,20,maxx-100,35);
setcolor(LIGHTRED);
setfillstyle(SOLID_FILL,DARKGRAY);
fillpoly(5,play);
fillpoly(5,help); setcolor(WHITE);
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
outtextxy(play[0]+2,play[1]-3,"PLAY");
outtextxy(help[0]+4,help[1]-3,"HELP");
firstdraw();
drawp1();
drawp2();
setcolor(WHITE);
settextstyle(GOTHIC_FONT,HORIZ_DIR,10);
outtextxy(100,340,"Dixsa");
} void firstdraw()
{
int temp,i,j;
temp=getcolor();
setcolor(YELLOW);
for(i=0;i<25;i++)
{
setfillstyle(SOLID_FILL,DARKGRAY);
fillpoly(5,box[i]);
if(i==2 i==10 i==14 i==22)
{
setcolor(WHITE);
line(box[i][0],box[i][1],box[i][4],box[i][5]);
line(box[i][2],box[i][3],box[i][6],box[i][7]);
setcolor(YELLOW);
}
}
setcolor(temp);
} void drawp1()
{
int temp;
temp=getcolor();
setcolor(LIGHTCYAN);
setfillstyle(SOLID_FILL,LIGHTCYAN);
sector(box[p1[player1[0]]][0]+10,box[p1[player1[0]]][1]+20,0,360,5,5);
sector(box[p1[player1[1]]][0]+80,box[p1[player1[1]]][1]+50,0,360,5,5);
sector(box[p1[player1[2]]][0]+65,box[p1[player1[2]]][1]+58,0,360,5,5);
sector(box[p1[player1[3]]][0]+24,box[p1[player1[3]]][1]+8,0,360,5,5);
setcolor(temp);
} void drawp2()
{
int temp;
temp=getcolor();
setcolor(LIGHTGREEN);
setfillstyle(SOLID_FILL,LIGHTGREEN);
sector(box[p2[player2[0]]][0]+45,box[p2[player2[0]]][1]+15,0,360,5,5);
sector(box[p2[player2[1]]][0]+25,box[p2[player2[1]]][1]+33,0,360,5,5);
sector(box[p2[player2[2]]][0]+65,box[p2[player2[2]]][1]+33,0,360,5,5);
sector(box[p2[player2[3]]][0]+45,box[p2[player2[3]]][1]+50,0,360,5,5);
setcolor(temp); setcolor(WHITE);
settextstyle(7,HORIZ_DIR,3);
outtextxy(box[12][0]+8,box[12][1]+14,"Home");
} int finish()
{
if(player1[0]==24 && player1[1]==24 && player1[2]==24 && player1[3]==24)
{
hidemouseptr();
setcolor(BLUE);
settextstyle(0,HORIZ_DIR,4);
outtextxy(box[10][0]+8,box[10][1]+15,"Computer wins"); settextstyle(5,HORIZ_DIR,3);
setcolor(BLUE);
outtextxy(100,maxy-250,"Click any where to End....");
showmouseptr();
return 1;
}
if(player2[0]==24 && player2[1]==24 && player2[2]==24 && player2[3]==24)
{
hidemouseptr();
setcolor(BLUE);
settextstyle(0,HORIZ_DIR,6);
outtextxy(box[10][0]+50,box[10][1]+14,"You won"); settextstyle(5,HORIZ_DIR,3);
setcolor(BLUE);
outtextxy(100,maxy-250,"Click any where to End....");
showmouseptr();
return 1;
}
return 0;
} int generate()
{
int x;
randomize();
x=random(5);
if(x==0)
return 1;
if(x==1)
return 2;
if(x==2)
return 3;
if(x==3)
return 4;
return 8;
} int select(int random)
{
int i,j,k; for(i=0;i<4;i++)
if((player1[i]+random)==24)
return i; for(j=0;j<4;j++)
{
k=player1[j]+random;
if(k==4 k==8 k==12)
return j;
} for(j=0;j<4;j++)
{
if(!invalid_comp(j,random))
{
k=player1[j]+random;
for(i=0;i<4;i++)
if(p1[k]==p2[player2[i]])
return j;
}
} if(!invalid_comp(0,random))
{
k=player1[0];
i=0;
for(j=1;j<4;j++)
{
if(!invalid_comp(j,random) && player1[j]>k)
{
k=player1[j];
i=j;
}
}
return i;
} if(!invalid_comp(1,random))
{
k=player1[1];
i=1;
for(j=2;j<4;j++)
{
if(!invalid_comp(j,random) && player1[j]>k)
{
k=player1[j];
i=j;
}
}
return i;
} if(!invalid_comp(2,random))
{
k=player1[2];
i=2;
if(!invalid_comp(j,random) && player1[3]>k)
{
k=player1[3];
i=3;
}
return i;
} return 3;
} int invalid(int sel,int random)
{
int i,t=player2[sel]+random;
if(t>24)
return 1;
if(t!=0 && t!=4 && t!=8 && t!=12 && t!=24)
for(i=0;i<4;i++)
if(player2[i]==t)
return 1;
return 0;
} int invalid_comp(int sel,int random)
{
int i,t=player1[sel]+random;
if(t>24)
return 1;
if(t!=0 && t!=4 && t!=8 && t!=12 && t!=24)
for(i=0;i<4;i++)
if(player1[i]==t)
return 1;
return 0;
} void draw_cavde(int random)
{
int i,j,k,a[4],x=maxx*3/4+20,y=maxy*3/4+20;
for(i=maxx*3/4+1;i<maxx;i++)
for(j=maxy*3/4+1;j<maxy;j++)
putpixel(i,j,BLACK);
if(random==1)
{
a[0]=1;
a[1]=a[2]=a[3]=0;
}
else
if(random==2)
{
a[0]=a[3]=1;
a[1]=a[2]=0;
}
else
if(random==3)
{
a[1]=a[2]=a[3]=1;
a[0]=0;
}
else
if(random==4)
a[0]=a[1]=a[2]=a[3]=1;
else
a[0]=a[1]=a[2]=a[3]=0; for(i=0;i<4;i++)
{
if(a[i])
{
setcolor(LIGHTBLUE);
setfillstyle(SLASH_FILL,WHITE);
fillellipse(x,y,16,4);
for(j=3;j<10;j++)
ellipse(x,y,180,360,17,j);
line(x-16,y-1,x+16,y-1);
line(x-16,y,x+16,y);
}
else
{
setcolor(LIGHTBLUE);
setfillstyle(LTBKSLASH_FILL,WHITE);
fillellipse(x,y,16,4);
for(j=3;j<10;j++)
ellipse(x,y,0,180,15,j); }
if(i==0)
x+=60;
if(i==1)
y+=40;
if(i==2)
x-=60;
} for(i=0;i<3;i++)
{
sound(568);
delay(10000);
nosound();
delay(10000);
}
sound(568);
delay(10000);
nosound();
} int can_play(int mx,int my,int random)
{
int i,k;
if(mx>ext[0] && mx<ext[4] && my>ext[1] && my<ext[5])
exit(0);
if(mx>help[0] && mx<help[4] && my>help[1] && my<help[5])
show_help(random);
if(mx>play[0] && mx<play[4] && my>play[1] && my<play[5])
return 1;
return -1;
} int getpon(int mx,int my,int random)
{
int i,k;
if(mx>ext[0] && mx<ext[4] && my>ext[1] && my<ext[5])
exit(0);
if(mx>play[0] && mx<play[4] && my>play[1] && my<play[5])
draw_cavde(random);
if(mx>help[0] && mx<help[4] && my>help[1] && my<help[5])
show_help(random);
for(i=0;i<25;i++)
if(mx>box[i][0] && mx<box[i][4] && my>box[i][1] && my<box[i][5])
break;
if(i==25)
return -1;
for(k=0;k<4;k++)
if(i==p2[player2[k]])
if(!(invalid(k,random)))
return k;
else
{
hidemouseptr();
setcolor(WHITE);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,2);
outtextxy(ext[0]-50,100,"This");
outtextxy(ext[0]-50,130,"PAWN can't");
outtextxy(ext[0]-50,160,"be moved"); sleep(1); setcolor(BLACK);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,2);
outtextxy(ext[0]-50,100,"This");
outtextxy(ext[0]-50,130,"PAWN can't");
outtextxy(ext[0]-50,160,"be moved");
showmouseptr();
}
return -1;
} void introduce()
{
int i,j,c;
cleardevice();
setbkcolor(BLACK); setcolor(YELLOW);
settextstyle(5,HORIZ_DIR,2);
outtextxy(200,170,"By,");
settextstyle(7,HORIZ_DIR,2);
outtextxy(240,200,"Raghu S");
outtextxy(240,240,"Krishna Kumar M G"); settextstyle(7,HORIZ_DIR,2);
outtextxy(10,335,"Guide : Rajashekhar K advaith");
outtextxy(10,375,"Co-ordinator : Rajesh D S"); settextstyle(GOTHIC_FONT,HORIZ_DIR,10);
c=WHITE;
for(i=0;i<375;i++)
{
setcolor(c);
outtextxy(i,0,"Dixsa");
delay(5);
setcolor(BLACK);
outtextxy(i,0,"Dixsa");
}
for(i=375;i>0;i--)
{
setcolor(c);
outtextxy(i,0,"Dixsa");
delay(5);
setcolor(BLACK);
outtextxy(i,0,"Dixsa");
}
for(i=0;i<150;i++)
{
setcolor(c);
outtextxy(i,0,"Dixsa");
delay(5);
setcolor(BLACK);
outtextxy(i,0,"Dixsa");
}
setcolor(c);
outtextxy(150,0,"Dixsa"); settextstyle(5,HORIZ_DIR,2);
setcolor(WHITE);
outtextxy(50,maxy-40,"Click any where to continue....");
showmouseptr();
getmouseptr();
hidemouseptr();
cleardevice();
} void show_help(int random)
{
give_rules();
hidemouseptr();
cleardevice();
draw();
if(random!=0)
draw_cavde(random);
showmouseptr();
} void sample_draw()
{
int s1=130,s2=40,i,j; setcolor(WHITE);
for(i=0;i<=5;i++)
for(j=0;j<5;j++)
{
line(s1+20*i,s2,s1+20*i,s2+100);
line(s1,s2+20*i,s1+100,s2+20*i);
}
line(s1+20*3,s2,s1+20*2,s2+20);
line(s1+20*2,s2,s1+20*3,s2+20);
line(s1,s2+20*3,s1+20,s2+20*2);
line(s1+20,s2+20*3,s1,s2+20*2);
line(s1+20*2,s2+20*3,s1+20*3,s2+20*2);
line(s1+20*3,s2+20*3,s1+20*2,s2+20*2);
line(s1+20*4,s2+20*3,s1+20*5,s2+20*2);
line(s1+20*5,s2+20*3,s1+20*4,s2+20*2);
line(s1+20*3,s2+20*4,s1+20*2,s2+20*5);
line(s1+20*2,s2+20*4,s1+20*3,s2+20*5); setcolor(RED);
line(s1+50,s2+10,s1+10,s2+10);
line(s1+10,s2+10,s1+10,s2+90);
line(s1+10,s2+90,s1+90,s2+90);
line(s1+90,s2+90,s1+90,s2+10);
line(s1+90,s2+10,s1+70,s2+10);
line(s1+70,s2+10,s1+70,s2+70);
line(s1+70,s2+70,s1+30,s2+70);
line(s1+30,s2+70,s1+30,s2+30);
line(s1+30,s2+30,s1+50,s2+30);
line(s1+50,s2+30,s1+50,s2+50);
setcolor(WHITE); s1=340;
for(i=0;i<=5;i++)
for(j=0;j<5;j++)
{
line(s1+20*i,s2,s1+20*i,s2+100);
line(s1,s2+20*i,s1+100,s2+20*i);
}
line(s1+20*3,s2,s1+20*2,s2+20);
line(s1+20*2,s2,s1+20*3,s2+20);
line(s1,s2+20*3,s1+20,s2+20*2);
line(s1+20,s2+20*3,s1,s2+20*2);
line(s1+20*2,s2+20*3,s1+20*3,s2+20*2);
line(s1+20*3,s2+20*3,s1+20*2,s2+20*2);
line(s1+20*4,s2+20*3,s1+20*5,s2+20*2);
line(s1+20*5,s2+20*3,s1+20*4,s2+20*2);
line(s1+20*3,s2+20*4,s1+20*2,s2+20*5);
line(s1+20*2,s2+20*4,s1+20*3,s2+20*5); setcolor(RED);
line(s1+50,s2+90,s1+90,s2+90);
line(s1+90,s2+90,s1+90,s2+10);
line(s1+90,s2+10,s1+10,s2+10);
line(s1+10,s2+10,s1+10,s2+90);
line(s1+10,s2+90,s1+30,s2+90);
line(s1+30,s2+90,s1+30,s2+30);
line(s1+30,s2+30,s1+70,s2+30);
line(s1+70,s2+30,s1+70,s2+70);
line(s1+70,s2+70,s1+50,s2+70);
line(s1+50,s2+70,s1+50,s2+50);
setcolor(WHITE);
} void give_rules()
{
hidemouseptr();
cleardevice();
setbkcolor(DARKGRAY);
setcolor(WHITE);
settextstyle(4,HORIZ_DIR,4);
outtextxy(250,5,"Dixsa"); sample_draw(); settextstyle(7,0,2);
setcolor(WHITE);
outtextxy(75,140,"Path for SYSTEM Path for PLAYER"); settextstyle(7,0,1);
setcolor(YELLOW);
outtextxy(5,170,". USE ONLY LEFT CLICK IN MOUSE FOR OBJECT SELECTIONS");
outtextxy(5,200,". There are 4 pawns for a player");
outtextxy(5,220," and one can cut the pawn of other except at CROSSED boxes");
outtextxy(5,250,". The path of pawns movement is as shown in above figures");
outtextxy(5,280,". To start playing click on 'PLAY' for each movement");
outtextxy(5,310,". The value of movement is found as follows:");
outtextxy(5,330," . There are 4 DIXSA's appearing to give value bellow 'PLAY'");
outtextxy(5,350," . If all DIXSA's are showing Upper surface = 8");
outtextxy(5,370," . Otherwise that = The number of Lower surfaces");
outtextxy(5,400,". Click on the box in which the pawn to be moved");
outtextxy(5,430,". Can't place 2 pawns of same player together except in CROSSED");
outtextxy(5,450," boxes"); settextstyle(5,HORIZ_DIR,2);
setcolor(WHITE);
outtextxy(140,maxy-32,"click any where to continue....");
showmouseptr();
getmouseptr();
}
thanks
yes
commercial software is made for profit. it is maintained by a company, and it's code is a trade secret, hidden, "closed source", because you can't see it (and therefore steal it) open source software is free to use. it is created not for profit, typically maintained by a community of individuals. its code is free for everyone to look at, modify, steal, etc. sometimes you will have trouble downloading open source software - make sure you download the "windows binaries" or "windows compile" and not the source code
An open source application software is a software application which also provides the users the opportunity to take the source code and edit it. Customizing the source code and sharing it to other users for free is a way to make sure that the software is meant to benefit the user and not the programmer.
Open source refers to code that is distributed outside of the manufacturer's company. Microsoft does not allow the code the programmers write for their programs outside of their company, so their code is proprietary, closed source. OpenOffice allows their code to be used by others. The reason for this is so that others can make improvements and customized enhancements. Open source is almost always free, where proprietary software has to be paid for, and is sometimes quite expensive.
There are sites on internet from where you can download Software Project Source Code Documentation for free. You can also buy a CD for the software.
which Website for free java project to be download with source code Free Download Project in asp.net,Java ,C#.Net ,Php on thisWebsite www.enggroom.com
There are lot of websites listing free source code. Like www.aspin.com, www.sourceforge.net and so on.
If I understand your question....vague as it is....yes, the Unix OS source code is free and open source.
Software can be categorized as:Closed Source : Source code is not available for general publicOpen Source : Source code is available for general public to seeNote that availability of the source code does not mean that the software is completely free. It is still possible that an Open Source Software is specifically licensed, for example to allow free use but not for free redistribution. On the other hand, it is also possible that a Closed Source Software is allowed to be use and distributed for free.
No, but there are many other open source project management applications, such as OpenGoo, etc.
thanks
pls provide the documents and code
Freeware
Having the source code open for anyone to edit or modify for free.
The benefits of a free code source website include software comes at a minimal cost, there are no imposed upgrades, there is no spying on users, and it provides better security.
yes