Webhosting in Pakistan
Page 1 of 3 123 LastLast
Results 1 to 12 of 36

Thread: [C Language] My First Project-THE TIC TAC TOE GAME

  1. #1
    Ijaz Farooq's Avatar
    Ijaz Farooq is offline Senior Member+
    Last Online
    2nd May 2015 @ 11:28 PM
    Join Date
    17 Jul 2011
    Location
    J.W-Bhakkar
    Age
    26
    Gender
    Male
    Posts
    11,319
    Threads
    415
    Credits
    703
    Thanked
    1349

    Default [C Language] My First Project-THE TIC TAC TOE GAME

    Webhosting in Pakistan
    السلام علیکم
    سمسٹر کے اینڈ میں پروگرومنگ فنڈامنٹل کے سر نے سی لینگوئج میں ایک اسائنمنٹ دی تھی
    کل وہ فائنالائز کی ہے
    یہ ایک سمپل گیم ہے
    جسے ٹِک ٹیک ٹو کہتے ہیں


    یقیناً آپ نے کھیلی ہوگی۔
    اس میں ایک پلئیر کراس اور ایک سرکل سمپل یوز کرتا ہے
    تاہم اس میں ایک پلئیر انگلش لیٹر ٹی اور دوسرا ایف یوز کرے گا
    Code:
    #include<stdio.h>
    #include<conio.h>
    #include<windows.h>
    #include<string.h>
    void restartgame();
    char tmp[3][3] = { '1', '2', '3', '4', '5', '6', '7', '8', '9' };
    char board[3][3] = { '1', '2', '3', '4', '5', '6', '7', '8', '9' };
    void restartgame();
    void verfication();
    void controling();
    void paterndraw();
    void startgame();
    void ResetPanel();
    char nam[20];
    char na[20];
    int i = 0, j = 0, a = 0;
    char m;
    int main(void)
    {
    	puts("This is TIC TAC TOE Game developed by Ijaz Farooq\n\n");
    	startgame();
    begin:
    	paterndraw();
    	controling();
    	verfication();
    	if (m == 'w')
    		restartgame();
    	else
    		goto begin;
    	return 0;
    }
    void startgame()
    {
    	printf("Game Instruction manual:\n**********************************\nPlayer 1 has 'F' and Player 2 has 'T' symbols during game.\nAdd position 1,2,3,4,5,6,7,8 or 9 to check T or F to in field.\nOnce u selected a position,then can never change it again.\n so be careful\nit's Rule of game.\n**********************************\nPress any key to continue\n");
    	_getch();
    	system("cls");
    	printf("First Player Name: \n");
    	scanf_s("%s", nam);
    	printf("Second Player Name: \n");
    	scanf_s("%s", na);
    }
    void paterndraw()
    {
    	system("cls");
    	for (i = 0; i<3; i++)
    	{
    		for (j = 0; j<3; j++)
    			printf("|__%c__|", board[i][j]);
    		printf("\n");
    	}
    	printf("__________________________________\n");
    	puts("Players have to Enter Position of field.(0-9)");
    	printf("__________________________________\n");
    }
    void ResetPanel()
    {
    	for (i = 0; i<3; i++)
    	{
    		for (j = 0; j<3; j++)
    			board[i][j] = tmp[i][j];
    	}
    	a = 0;
    	printf("Press 'r' to Play again.\n");
    	if (_getch() != 'r')
    		printf("Game Closed!! Run again*");
    	else
    		main();
    }
    void restartgame()
    {
    	system("cls");
    	if (a % 2 == 1)
    		printf("%s Won the game!!\n", nam);
    	else
    		printf("%s Won the game!!\n", na);
    	ResetPanel();
    }
    void verfication()
    {
    	for (i = 0; i<3; i++)
    	{
    		if (board[i][0] == board[i][1] && board[i][0] == board[i][2])
    			m = 'w';
    		else if (board[0][i] == board[1][i] && board[0][i] == board[2][i])
    			m = 'w';
    		else if (board[0][2] == board[1][1] && board[0][2] == board[2][0] || board[0][0] == board[1][1] && board[0][0] == board[2][2])
    			m = 'w';
    	}
    }
    void controling()
    {
    	a++;
    	if (a % 2 == 1)
    		printf("%s to Play...\n(Symbol : 'F') Insert Position: ", nam);
    	else
    		printf("%s to Play...\n(Symbol : 'T') Insert Position: ", na);
    	m = _getch();
    	for (i = 0; i<3; i++)
    	{
    		for (j = 0; j<3; j++)
    		{
    			if (board[i][j] == m)
    			{
    				if (a % 2 == 1)
    					board[i][j] = 'F';
    				else
    					board[i][j] = 'T';
    				break;
    			}
    		}
    		if (j != 3)
    			break;
    	}
    	if (i == 3)
    		a--;
    	else if (a == 9 && m != 'w'){
    		system("cls");
    		ResetPanel();
    	}
    }
    ٹرائی کیجئے اُمید ہے آپ کو پسند آئے گی
    [IMG]http://i1304.***********.com/albums/s521/ridau/1_zpsc4cba97f.png[/IMG]


    Tic Tac Toe In C

    ------------------------------------------
    میں اسکا سورس کوڈ بھی دے رہا ہوں تاکہ کوئی چینجنگ کرنا چاہے تو موسٹ ویلکم
    Source Code.txt
    Source Code.c
    Attached Files Attached Files

  2. The Following 2 Users Say Thank You to Ijaz Farooq For This Useful Post:

    Awesome_Boy (22nd March 2014), Skipper (22nd March 2014)

  3. #2
    Ijaz Farooq's Avatar
    Ijaz Farooq is offline Senior Member+
    Last Online
    2nd May 2015 @ 11:28 PM
    Join Date
    17 Jul 2011
    Location
    J.W-Bhakkar
    Age
    26
    Gender
    Male
    Posts
    11,319
    Threads
    415
    Credits
    703
    Thanked
    1349

    Default

    Game Running On Android OS:
    [IMG]http://i1304.***********.com/albums/s521/ridau/Screenshot_2014-03-21-18-00-27_zps2abbe0da.png[/IMG]

    [IMG]http://i1304.***********.com/albums/s521/ridau/Screenshot_2014-03-21-18-00-36_zps09941d48.png[/IMG]

    [IMG]http://i1304.***********.com/albums/s521/ridau/Screenshot_2014-03-21-18-00-43_zps6aa37212.png[/IMG]

    [IMG]http://i1304.***********.com/albums/s521/ridau/Screenshot_2014-03-21-18-00-54_zps8d851e3c.png[/IMG]

    [IMG]http://i1304.***********.com/albums/s521/ridau/Screenshot_2014-03-21-18-00-59_zpsfa961a3b.png[/IMG]

    [IMG]http://i1304.***********.com/albums/s521/ridau/Screenshot_2014-03-21-18-01-19_zpsabb97242.png[/IMG]

    [IMG]http://i1304.***********.com/albums/s521/ridau/Screenshot_2014-03-21-18-01-23_zps676c0537.png[/IMG]

  4. The Following 2 Users Say Thank You to Ijaz Farooq For This Useful Post:

    Awesome_Boy (22nd March 2014), IqraIqbal (27th September 2014)

  5. #3
    The Genius's Avatar
    The Genius is offline Senior Member
    Last Online
    16th May 2019 @ 08:48 PM
    Join Date
    21 Feb 2011
    Gender
    Male
    Posts
    977
    Threads
    16
    Credits
    541
    Thanked
    85

    Default

    Why don't you use Letter 'X' and 'O' instead of 'F' and 'T'

  6. #4
    WAQAS1412's Avatar
    WAQAS1412 is offline Senior Member
    Last Online
    5th September 2017 @ 12:57 PM
    Join Date
    01 Apr 2013
    Location
    Islamabad
    Age
    22
    Gender
    Male
    Posts
    8,617
    Threads
    159
    Credits
    13
    Thanked
    622

    Default

    [CENTER][IMG]http://s18.postimg.org/w55naz6dl/Signature_1.gif[/IMG]
    [/CENTER]

  7. #5
    Noman_Khan's Avatar
    Noman_Khan is offline Advance Member+
    Last Online
    29th September 2019 @ 02:05 PM
    Join Date
    06 Aug 2013
    Location
    @Itdunya.com
    Gender
    Male
    Posts
    6,793
    Threads
    142
    Credits
    79
    Thanked
    714

    Default

    بہت خوب جناب
    یہ وقت بھی گزر جائے گا

  8. #6
    Awesome_Boy's Avatar
    Awesome_Boy is offline Senior Member+
    Last Online
    11th October 2016 @ 04:15 PM
    Join Date
    22 Apr 2013
    Location
    Islamabad
    Gender
    Male
    Posts
    7,772
    Threads
    258
    Credits
    6,794
    Thanked
    1013

    Default

    وعلیکم اسلام
    بہت عمدہ شئیرنگ اعجاز بھائی
    ویلڈن

  9. #7
    yasir_hoth's Avatar
    yasir_hoth is offline Senior Member+
    Last Online
    25th June 2014 @ 12:18 PM
    Join Date
    04 Oct 2013
    Location
    sindh
    Gender
    Male
    Posts
    4,093
    Threads
    104
    Credits
    0
    Thanked
    490

  10. #8
    Join Date
    22 Nov 2012
    Location
    Planets...!!!
    Gender
    Male
    Posts
    1,775
    Threads
    116
    Thanked
    277

    Default

    وعلیکم السلام۔۔
    چیک کرتے ہیں۔۔۔۔۔۔۔
    اشتراک کیلئے بہت شکریہ۔۔۔۔۔۔۔۔۔۔

  11. #9
    UMAR_DRAZ's Avatar
    UMAR_DRAZ is offline Senior Member+
    Last Online
    22nd December 2019 @ 02:43 PM
    Join Date
    16 Jul 2013
    Location
    Jabbi khushab
    Gender
    Male
    Posts
    1,681
    Threads
    25
    Credits
    1,836
    Thanked
    153

    Default

    Nice g thanks

  12. #10
    Skipper's Avatar
    Skipper is offline Senior Member
    Last Online
    7th January 2019 @ 09:23 AM
    Join Date
    20 Jun 2010
    Location
    Sheher-e-Quaid
    Age
    26
    Gender
    Male
    Posts
    8,858
    Threads
    103
    Credits
    922
    Thanked
    1161

    Default

    Walaikumussalam
    Bohot hi umda kaawish
    Aap isko mazeed khubsurat banasaktai hain graphic.h aur mouse programming use karke..
    Bohot hi acha idea aur umda kaam.

  13. The Following User Says Thank You to Skipper For This Useful Post:

    Ijaz Farooq (22nd March 2014)

  14. #11
    Mehtab R's Avatar
    Mehtab R is offline Senior Member+
    Last Online
    9th June 2014 @ 12:21 PM
    Join Date
    22 Mar 2014
    Location
    Wahi pandhi
    Age
    21
    Gender
    Male
    Posts
    271
    Threads
    17
    Credits
    0
    Thanked
    14

    Default

    Very nice

  15. #12
    hamzachohan is offline Senior Member
    Last Online
    15th April 2019 @ 12:23 AM
    Join Date
    26 Dec 2010
    Age
    26
    Gender
    Male
    Posts
    632
    Threads
    57
    Credits
    837
    Thanked
    192

    Default

    Webhosting in Pakistan
    Good work

Page 1 of 3 123 LastLast

Similar Threads

  1. 2nd year Access Database project
    By USMANHEART in forum 12th
    Replies: 16
    Last Post: 3rd June 2018, 06:30 PM
  2. 2nd year computer project
    By USMANHEART in forum 12th
    Replies: 23
    Last Post: 4th March 2013, 12:29 PM
  3. Replies: 2
    Last Post: 19th March 2010, 05:51 PM
  4. Web Developers Required(Have 1grand Project)
    By kanch in forum English IT Zone
    Replies: 1
    Last Post: 5th February 2009, 12:31 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •