Posts

Showing posts with the label game

Explanation of the main function of Tic Tac Toe reloaded

Below, I have explained main code for manual mode. For automatic mode, we need to follow some extra step, which I will explain in later posts. So follow me to keep updated. Please check my source code post to check full code file, as there are some mistakes in code below. #include "stdafx.h" #include<iostream> #include<conio.h> #include<proces.h> #include<vector> #include<cstdlib> #include<fstream> From starting we have some INCLUDE statement to include the libraries which we needed in this program.  On line 1 is the library of visual studio which it uses for indentation and format. So, it always included in visual studio project. Line 2 is for input/output stream, this provides the basic print statements and input/output. Line 3 is used for getch() function to hold the screen, it is like co-ordination of input and output. Line 4 is used some processing library and for clear screen. On some compiler, you can directly use...

Source code of Tic-Tac-Toe Reloaded

Image
You can download the source code from here:                  For Automatic Mode : Automatic                  For Manual Mode: Manual You can run it on Visual Studio. If you first time trying visual studio then you have to make a new project as given below. File->New->Project->Visual c++->Window Desktop->Windows Console Application  After giving the name and finish you can copy the code from above file and paste it into your application.  After running this program, You can see the saved results by going to the  directory where project saved and see the files shown below:

Simple Tic-Tac-Toe

Image
Below you can find the code of Simple Tic Tac Toe in C++ and little explanation how it works. If you copy and paste this code, it works fine in Visual studio or with any C++ compiler. If you are already familiar with  Tic Tac Toe code in c++, then you can directly move to my game. Otherwise you should first try this and understand it.. I have explained working of all these functions below this code.   #include <iostream.h> //<iostream> in vs2017   using namespace std;   char square[10]={'o','1','2','3','4','5','6','7','8','9'};   int checkwin();   void board();   int main()   {        int player=1,i,choice;        char mark;        do       {          board();          player=(player%2)?1:2;           cout <<"Player"<<player;       ...

Idea about Tic-Tac-Toe Realoded in c++

Image
Have you tried Tic-Tac-Toe in C++, It is good for a beginner to start. I tried it, when I am in my first year of graduation. At that time I am curious about machine learning, artificial intelligence and vision of AI. It all started, when I read a book on AI. On first chapter of the book, they explained working of tic-tac-toe. There is a tree of possibilities of decisions we can take in the game of tic-tac-toe. At that time I just have beginner knowledge of C++. But I decided to make tic-tac-toe with machine learning capabilities and named it Tic-Tac-Toe Reloaded.  I have started with simple idea based on the learning from win results, so computer can store his winning pattern and reuse on same input in future. There is a movie called Chappie(2015), which is well determination of an AI we want. So keep with me to try this simple program, I have explained most of things on this blog and let me know something I missed in comments. If you have not  tried simple tic-tac-to...