Write a matlab program to allow two players to play

Assignment Help Computer Engineering
Reference no: EM132153418

Topics: User Defined Functions and MATLAB Conditionals

A Childrens game studio needs you to write a MATLAB Program to allow two players to play the game Tic-Tac-Toe on a computer:

This is a two player (X's and O's) board game.

The game board is a 3 X 3 grid, where each location can hold either an 'X' an 'O' or a space (empty) Note: we will linearize the grid and refer to the its locations as 1 - 9, for conveyance.

The players take turns placing their mark into one of the (empty) locations in the grid.

The game is won when a player has their mark in all three locations of any row, column, or diagonal.

The game can also reach a stalemate: neither player has won (by above criteria) however all there are no more empty locations in the grid.

Outline:

Create a MATLAB Script .m file

Establish variable(s) to represent the nine board locations

Create the game loop

i.Display the current state of the board - using separate displayBoard function

ii.Get a "valid" move location - note this can only be an empty location [1, 9]

iii.Modify the board variable(s)

iv.Check for a win and report it if so - game must end

v.Check for a stalemate - game must end

Create a MATLAB Function .m file

Establish its name (displayBoard), input(s) , and output (there really is not any)

Write the necessary MATLAB commands to display the Tic-Tac-Toe board, using the given input(s)

Make sure to test your script and function when they are done

Notes(s):

Keep track of the total number of moves, for an easy stalemate detection.

Your location choice user-validation loop must also not accept any location that is not currently empty.

At times things will feel very tedious - doing the "same" thing nine times ...

Reference no: EM132153418

Questions Cloud

Write one blog entry-news article : Each student will write one blog entry/news article (around 300-500 words) for our Environmental Science News blog (not a real blog).
Explain why a lorenz curve : Explain why a Lorenz curve can never lie to the left or above the 45 degree line.
What is translatinal look-aside buffer : What is Translatinal look-aside buffer (TLB)? What is it for? What is stored in this memory?
Address problem of population growth : What four roles can developed countries play in helping developing countries address problem of population growth?
Write a matlab program to allow two players to play : The game can also reach a stalemate: neither player has won (by above criteria) however all there are no more empty locations in the grid.
How the term affects living things and the physical world : Explain how the term affects living things and the physical world. Relate the term to the challenge of achieving environmental sustainability.
Implement to address population growth : What four policy initiatives can developing countries implement to address population growth?
How does air pollution affect visibility : How does air pollution affect visibility? Describe the detrimental effects of atmospheric haze. What are the effects of acid rain on vegetation and wildlife?
Poverty in developing countries : Explain why policies designed to reduce urban unemployment may not greatly reduce poverty in developing countries.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd