GithubHelp home page GithubHelp logo

tic-tac-toe-asm's Introduction

Tic-tac-toe-asm

a short game using assembly language .\

The Algorithms:

Function name DrawInterfaceWhenYouStart to illustrate the friendly user interface, also the number from 1 to 9 to know exactly where player can play the game.

Function name DrawInterface to show each player move.

Function CheckWin to check 8 case {123, 456, 789, 147, 258, 369, 357, 159} if there any player win or not if so Boolean GameContinues become false. In main function we have:

Boolean GameContinues as mention above to check if game need to stop or not. Boolean OX to check we are in player X turn or in player O turn, also to know which player win. An integer i = 0, we count up to 1 each time a player make a movement until 9 if there is no player win we jump out loop, print “draw” and exit program An array of character has value ‘ ‘ (spacebar).

We have a Loop: as while(GameContinues), Inside loop we have if(OX) , OX true we play as O player false we play as X player, after we have done implement in parameter we reverse state of OX. In each player turn we get player input as integer from 1 to 9 and assign X or O into the character array.

If there already exit one or invalid input we print a warning to player and get input from player again.

If the input valid we call DrawInterface function to draw, call CheckWin to check if any player win, reverse value of OX increase i by 1 and go to Loop: again.

If CheckWin return GameContinues false we break the Loop: and print out the win player (by check OX).

In case there is no player win through 9 turn, we also break the Loop: and print out draw.

tic-tac-toe-asm's People

Contributors

windyfeg avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.