Wednesday, November 28, 2012

Quiz game in C language complete source code download


C language is the basic language in the programming field. every programmer starts the programming from the C language. Generally in the IT field like Computer Engineerung or any related computer field, we are taught the C language and at the end of the class, we are asked to do a simple project  implementing C language. At this situation we may be in delime about what to do in the project as C project.In that particular condition  The Quiz game can be one of the alternative to us. It implemts almost every part we learn in the course from simple input/output to the file implementation.

INTRODUCTION

Quiz game is a very popular General Knowledge Game. The quiz game increases the IQ knowledge of the player. It is used to check the knowledge within us.
The provided source code is the simple Quiz game programmed  implementing C language. In this programe The several question are provided  to the player.The player are provided with 4 option in it. Player is all need to choice the suitable option from the 4 option available in the screen. The player need to type either A,B,C,or D according to the suitable answer provided in it.
The player will score the points with each correct answer provided. If the player is unable to answer the question, then correct answer is provided. The user are given 3 chance in it. The game will be terminated with score and suggestion displayed if the user goes to incorrect answer for consequitive 3 chances.

At the beginning of the game menu is provided .according to the menu user need to proceed in it. Also File is used in it to store the points scored by the player. The player can see the highest score through this file through the menu .
24 question are included in it,however we can add further question as per our need.


DOWNLOAD SOURCECODE WITH OUTPUT HERE

I hope this article will be helpful in the project regarding  the C programming project. The quiz program is really intresting project to begin programming project for the beginners. The code is simple and clean.  I appreciate the comment and any feedback ,Please.

Thursday, November 22, 2012

Tiger and Goat(Baghchal) game-Artificial Intelligence game sourcecode in c++


 Introduction:

Baghchaal is a Typical Nepali game.It is also called tiger and goat game. The main aim of this game is that the tigers tries to eat the goat as more as it can whereas the goat tries to trap the tiger to its moveless position.
baghchaal board





RULES

At the start of the game, all four tigers are placed at the four edge of the board facing the center of the grid.Then the goat needs to be placed in the grid turn by turn alternately with the tiger.

The goat must be placed at the intersection of the board and follow the lines.There are 20 goats available  in this game.once the 20 goats are placed in the grid. Then the move should be made from the placed goat in the grid.

The tiger captures the goat by jumping over them to an adjacent free position.


Sourcecode detail:

game:   tiger and goat(baghchaal)
language:  visual c++
IDE      : visual studio

The sourcecode available is a artificial intelligence game. The computer player is the tiger and the user is goat. Here the image used are wasp as tiger and butterfly as goat.
The user can handle the butterfly with the use of mouse. The user just need to point the goat and drag to the desire place.


OUTPUT:




download sourcecode here
















Wednesday, November 21, 2012

MINOR PROJECT tic -tac-toe with artificial intelligence sourcecode in c++ download

Tic-tac-toe is a simple two player game. It is a pen and paper game.It is mostly played especially in childhood between two player. each player tries to complete the boxes horizontally,vertically or diagonally. The player to finished first is declared the winner.


This game can be of several form with AI or without AI. Here the mentiioned code is the game with artificial intelligence. The human player can play against the computer player. and the code given to download is in C++


DOWNLOAD SOURCECODE HERE

Tic-tac- toe game sourcecode in C

INTRODUCTION

Tic-tac-toe is a simple two player game. It is a pen and paper game.It is mostly played especially in childhood between two player. each player tries to complete the boxes horizontally,vertically or diagonally. The player to finished first is declared the winner.

This is a simple  game without the AI(artificial intelligence). This code doesnot contain the AI i.e player cannot play against the computer player.


HERE IS THE COMPLETE CODE:

/* This is the complete source code of tic tac toe in C language. It is perfectly run in the codeblocks IDE */

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include <windows.h>



int board[10] = {2,2,2,2,2,2,2,2,2,2};
int turn = 1,flag = 0;
int player,comp;

void menu();
void go(int n);
void start_game();
void check_draw();
void draw_board();
void player_first();
void put_X_O(char ch,int pos);
 COORD coord={0,0}; // this is global variable
                                    //center of axis is set to the top left cornor of the screen
void gotoxy(int x,int y)
{
    coord.X=x;
    coord.Y=y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}



 void main()
{
 system("cls");
 menu();
 getch();

}

void menu()
{
 int choice;
 system("cls");
 printf("\n--------MENU--------");
 printf("\n1 : Play with X");
 printf("\n2 : Play with O");
 printf("\n3 : Exit");
 printf("\nEnter your choice:>");
 scanf("%d",&choice);
 turn = 1;
 switch (choice)
 {
  case 1:
   player = 1;
   comp = 0;
   player_first();
   break;
  case 2:
   player = 0;
   comp = 1;
   start_game();
   break;
  case 3:
   exit(1);
  default:
   menu();
 }
}

int make2()
{
 if(board[5] == 2)
  return 5;
 if(board[2] == 2)
  return 2;
 if(board[4] == 2)
  return 4;
 if(board[6] == 2)
  return 6;
 if(board[8] == 2)
  return 8;
 return 0;
}

int make4()
{
 if(board[1] == 2)
  return 1;
 if(board[3] == 2)
  return 3;
 if(board[7] == 2)
  return 7;
 if(board[9] == 2)
  return 9;
 return 0;
}

int posswin(int p)
{
// p==1 then X   p==0  then  O
 int i;
 int check_val,pos;

 if(p == 1)
  check_val = 18;
 else
  check_val = 50;

 i = 1;
 while(i<=9)//row check
 {
  if(board[i] * board[i+1] * board[i+2] == check_val)
  {
   if(board[i] == 2)
    return i;
   if(board[i+1] == 2)
    return i+1;
   if(board[i+2] == 2)
    return i+2;
  }
  i+=3;
 }

 i = 1;
 while(i<=3)//column check
 {
  if(board[i] * board[i+3] * board[i+6] == check_val)
  {
   if(board[i] == 2)
    return i;
   if(board[i+3] == 2)
    return i+3;
   if(board[i+6] == 2)
    return i+6;
  }
  i++;
 }

 if(board[1] * board[5] * board[9] == check_val)
 {
  if(board[1] == 2)
   return 1;
  if(board[5] == 2)
   return 5;
  if(board[9] == 2)
   return 9;
 }

 if(board[3] * board[5] * board[7] == check_val)
 {
  if(board[3] == 2)
   return 3;
  if(board[5] == 2)
   return 5;
  if(board[7] == 2)
   return 7;
 }
 return 0;
}

void go(int n)
{
 if(turn % 2)
  board[n] = 3;
 else
  board[n] = 5;
 turn++;
}

void player_first()
{
 int pos;

 check_draw();
 draw_board();
 gotoxy(30,18);
 printf("Your Turn :> ");
 scanf("%d",&pos);

 if(board[pos] != 2)
  player_first();

 if(pos == posswin(player))
 {
  go(pos);
  draw_board();
  gotoxy(30,20);
  //textcolor(128+RED);
  printf("Player Wins");
  getch();
  exit(0);
 }

 go(pos);
 draw_board();
 start_game();
}

void start_game()
{
 // p==1 then X   p==0  then  O
 if(posswin(comp))
 {
  go(posswin(comp));
  flag = 1;
 }
 else
 if(posswin(player))
  go(posswin(player));
 else
 if(make2())
  go(make2());
 else
  go(make4());
 draw_board();

 if(flag)
 {
  gotoxy(30,20);
  //textcolor(128+RED);
  printf("Computer wins");
  getch();
 }
 else
  player_first();
}

void check_draw()
{
 if(turn > 9)
 {
  gotoxy(30,20);
  //textcolor(128+RED);
  printf("Game Draw");
  getch();
  exit(0);
 }
}

void draw_board()
{
 int j;

 for(j=9;j<17;j++)
 {
  gotoxy(35,j);
  printf("|       |");
 }
 gotoxy(28,11);
 printf("-----------------------");
 gotoxy(28,14);
 printf("-----------------------");

 for(j=1;j<10;j++)
 {
  if(board[j] == 3)
   put_X_O('X',j);
  else
  if(board[j] == 5)
   put_X_O('O',j);
 }
}

void put_X_O(char ch,int pos)
{
 int m;
 int x = 31, y = 10;

 m = pos;

 if(m > 3)
 {
  while(m > 3)
  {
   y += 3;
   m -= 3;
  }
 }
 if(pos % 3 == 0)
  x += 16;
 else
 {
  pos %= 3;
  pos--;
  while(pos)
  {
   x+=8;
   pos--;
  }
 }
 gotoxy(x,y);
 printf("%c",ch);
}



OUTPUT:

Sunday, November 4, 2012

Hostel Managment Database Project sourcecode in .Net free Download

Hostel  Management project is a Database project .It is coded under .net framework and the IDE used is Visual studio 2010 and the database used is SQL Server management studio 2008

To run the below code ,Note you must have install the visual studio 2010. and you should create the database yourself. The database is not provided here.



Dot and Box -AI based game sourcecode in C# download


                                            INTRODUCTION

Starting with an empty grid of dots, players take turns, adding a single horizontal or vertical line between two unjoined adjacent dots. A player who completes the fourth side of a 1×1 box earns one point and takes another turn. (The points are typically recorded by placing in the box an identifying mark of the player, such as an initial). The game ends when no more lines can be placed. The winner of the game is the player with the most points.
Dots and Boxes is a very simple game. Two players take turns drawing lines between dots on the game board. When a player draws a line that completes a box, the player "owns" that box. Whoever owns more boxes when the game board is full is the winner. The board can be of any size.


                                               METHODOLOGY


Regarding the language C# language will be used in the programming of dot and box game. Visual studio 2010 will be used as the IDE for the development of the project.
 Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop console and graphical user interface applications along with Windows


REFERENCES:
       







 Download the sourcecode and report here