Preview

Report. Tic-Tac-Toe

Good Essays
Open Document
Open Document
980 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Report. Tic-Tac-Toe
Modeling and Software Development

Individual coursework

Tic-Tac-Toe
Matlab code

Introduction
Tic-Tac-Toe is a popular simple game for two players all over the world. Traditionally one person plays for “X” while another plays for “O”. The game is played on the square board of 3x3 or even more size. The aim of this game for player is to win by filling with “X” or “O” any row, column or diagonal of the main game board. The game sets players thinking because players should reflect a little bit on strategy and predict some moves of the opponent. So it teaches people to make decisions quickly.
MATLAB is computer software for technical computing from the MathWorks. Used for a wide variety of scientific and engineering calculations. The functions of the MATLAB are solving equations, plotting 2D, 3D graphs, calculating statistics, etc.
The aim of the report is to describe how Tic-Tac-Toe game simulation was made with the help of MATLAB. The report describes how program reads the code and computer strategy for winning/not losing in the game.

Theory.
The aim the individual coursework was to program 4x4 Tic-Tac-Toe game for player and computer using MATLAB with condition that computer should always win or just not loose. Programming the game basic loops such as “while”, “for”, “if” were used, where “while” means to repeat smth until some particular conditions are holding, “for” means to do smth for particular conditions, and “if” means to do smth if some conditions are true. There also were used “sum” function which helps to count “X”-s or “O”-s in rows, columns, diagonals and basic commands for matrices.

Methodology
The game is played in command window, using the matrice 4x4, where “X” is 1, “O” is -1 and empty cells are zeros. The main algorithm of the program is on Graph 1.

Graph 1. The main algorithm of the Tic-Tac-Toe program.
The game is starting by choosing randomly either computer is playing for “X” or for “O”. Then first move is

You May Also Find These Documents Helpful

  • Better Essays

    Unit 22 Asseement

    • 1496 Words
    • 6 Pages

    |Unit Title: |Unit Number: | |Developing computer games |22 | |Level of Award: 3 |Centre Number: 16405 | |Candidate Name: |Candidate Number: | |Learning Hours: 60 |Duration of Academic Year: 1 Term | |Unit Deadline: | |Assignment Brief Author: Mr Badhasha | |Tutor/Assessor | |Signed: |Date: | |Final Grade: |Date: | |Assignment Internal Verifier: | |Signed: |Date: | |Tutor/Assessor Comments: | |…

    • 1496 Words
    • 6 Pages
    Better Essays
  • Good Essays

    Unit 16 Ao1

    • 529 Words
    • 3 Pages

    Programs, especially computer games, are usually not linear; they are not carried out sequentially but jump around the code as different parts are needed. It is not always possible to predict what the user will do, therefore good programming allows the user the freedom to do…

    • 529 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Lab 5

    • 463 Words
    • 5 Pages

    This program takes input from the user taking player names (up to 100) and player scores (up to 100).…

    • 463 Words
    • 5 Pages
    Satisfactory Essays
  • Satisfactory Essays

    The first person to make it all the way around the board wins. You need the exact number to finish.…

    • 119 Words
    • 1 Page
    Satisfactory Essays
  • Good Essays

    This examination is designed to test your ability to calculate efficiently with the aid of MATLAB as…

    • 1357 Words
    • 17 Pages
    Good Essays
  • Powerful Essays

    Mullins stated that, organisational effectivness and performance depends upon thes sucesfull management of the opportunities, challanges and risk presented changes in the external enviroment.…

    • 2055 Words
    • 9 Pages
    Powerful Essays
  • Powerful Essays

    no win situations

    • 1308 Words
    • 5 Pages

    6.Orlick and others have devised or collected hundreds of such games for children and adults alike. The underlying theory is simple: All games involve achieving a…

    • 1308 Words
    • 5 Pages
    Powerful Essays
  • Good Essays

    The Pavilion Checkers Classic Board Game provides a similar range of interactive possibilities that involve logical thinking and strategic planning with an opponent. At this stage, the young person begins top understand abstract thought, which involves moving various circular pieces in order to “jump” an opponent’s piece on the board. After jumping the other player’s piece, the player can take that piece until the opponent has lost all of his or her pieces. This game is a classic game that is not too difficult to learn, but it takes more logical mental strategies to be able to comprehend the game at this stage of…

    • 1589 Words
    • 7 Pages
    Good Essays
  • Powerful Essays

    Computer Engineering

    • 1702 Words
    • 7 Pages

    Simon, Herbert A. And Munakata, Toshinori. "AI Lessons: (Artificial Intelligence: IBM 's Deep Blue Chess Computer)," Communications of the Association for Computing Machinery (1997): August, Vol. 40, No. 8, pp. 23-26.…

    • 1702 Words
    • 7 Pages
    Powerful Essays
  • Good Essays

    MATLAB

    • 1938 Words
    • 20 Pages

    EG-264 Computer Aided Engineering Dr Mike Clee College of Engineering Swansea University Semester 1, 2014-2015 General Information • Lectures and Computer Laboratory Classes – Two 1-hour lecture slots allocated to these courses in the timetable • These slots will be used in weeks 2-4 – Throughout term a PC lab session is available every week • Students should attend lab sessions when possible Semester 1, 2014-2015 Structure of EG-264 • Two components – MATLAB – Revision, Numerical Integration, Root Finding • Dr Mike Clee • Lectures – Weeks 2-4, Labs – Weeks 3-5 • 50% 1 assignment – CAD – Solidworks • Dr Chengyuan Wang • Lectures Weeks 5-6, Labs – Weeks 6-12 • 50% – 1 assignments Semester 1, 2014-2015 General Information • MATLAB lab slots – There will be demonstrators in each lab to help with MATLAB worksheets – Each student has the opportunity to complete the assignment during the lab sessions – Remember - MATLAB labs will be held between Week 3 and Week 5 this is where help will be available.…

    • 1938 Words
    • 20 Pages
    Good Essays
  • Satisfactory Essays

    Sudoku Game

    • 426 Words
    • 2 Pages

    The main objective of this project is to create a game through which the user will be able to play a Sudoku puzzle. Our project deals with the task of designing a game of Sudoku using various algorithms. These are algorithms, both for generating games of various difficulties for the user and also for solving the puzzles provided by the user. A user will be able to ask for a random puzzle or the user will be able to manually input a puzzle. In either case, the software will be able to ask for a hint showing the next easiest step. The user will able to perform some other tasks such as saving the current game, loading a game of the specified format, changing the looks of the software disabling sound, ask for help and so on.…

    • 426 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Sudoku

    • 539 Words
    • 3 Pages

    Nowadays, sudoku appears as a popular puzzle games. It easily can be found on the newspapers and also on the internet. This kind of games are good for brain. Other than that, sudoku also gives another benefits for the players. Based on reading from a number articles and sources, the benefits of the sudoku are increasing the logical skills, develop patience, enhances mental sharpness and provide good alternative. With playing the sudoku, it will improve the capabilities of thinking logically or critically. This kind of games provide the good alternative for the childrens compared to spending times to play the digital games or watching TV because it offers an educational for them. Sudoku will increase their mathematical skills and confident level. The specific mathematical calculations are no required to solving Sudoku but it will use a few of mathematical methods and techniques.…

    • 539 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Chess is known as one of the world’s most popular board game that can be played by 2 players. This game was originated in India that used to be an ancient game. The board used in the game is called chessboard that holds 64 squares and ordered in 8X8 grid. It’s same with checker board only difference is that the size. Since this board game is being played by 2 players, there will be 2 colors, black/brown and white. Each player will have 16 chess pieces. These 16 pieces contain 1 King, 1 Queen, 2 Rooks, 2 Knights, 2 Bishops, and 8 Pawns which have particular movement styles. Can be played just for fun or by tournament.…

    • 2372 Words
    • 10 Pages
    Good Essays
  • Satisfactory Essays

    Effects of Video Games

    • 282 Words
    • 2 Pages

    Action games, according to a study by the University of Rochester, train the brains of players to make faster decisions without losing accuracy. In today’s world, it is important to move quickly without sacrificing accuracy.…

    • 282 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Board Game

    • 2555 Words
    • 11 Pages

    Board games used for a number of educational purposes, as have been proven to help stimulate the minds of children in a fun and informative way. Learning things like conservation of energy, mathematical operations can be difficult for young children, usually depending on their age and the amount of attention they have received on the object. It has also been long proven that most children have a better time learning skills when they are presented in a fun, interactive format, and giving educational math board games on which to make their stand. Sci - Damaths ( Sci = Science, Dama = Pinoy game checker board, maths = mathematics) is one such board game which helps children to easily begin to master the skills of basic math and energy conservation. The game plays out across a table, much like Pinoy typical game DAMA . There are 24 chips in each set of the game, which come in editions for each basic math & science skill. Some set focus on addition, while others help players learn their addition, subtraction, multiplication, and division skills. The easy format helps any player to adapt quickly to the game and with a fun, slightly competitive…

    • 2555 Words
    • 11 Pages
    Powerful Essays