Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Tic Tac Toe Help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Joy




PostPosted: Thu Jan 08, 2015 11:02 am   Post subject: Tic Tac Toe Help

What is it you are trying to achieve?

A simple tic tac toe game without advanced commands, and without using arrays. It is for grade 10 culminating assignment.


What is the problem you are having?

I can't figure out how to make this game without using arrays. I am having the biggest problem with starting it off as well.

Describe what you have tried to solve this problem

Just started.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




[/syntax]

Please specify what version of Turing you are using

4.1
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Thu Jan 08, 2015 7:08 pm   Post subject: RE:Tic Tac Toe Help

Quote:
A simple tic tac toe game without advanced commands, and without using arrays.


This is a seriously moronic restriction, but you can partially get around it by using strings in place of arrays. If you're not comfortable with strings, then that might cause a headache.

Fortunately, tic-tac-toe is a pretty simple game with only 9 tiles, so you can just write 9 variables to hold the game state. var topleft, topmiddle, topleft, middleleft, middlemiddle, etc. Now you can write a couple of functions that together can pretend to be an array. For example,
code:

function getVariable (int x, int y) : int
if x = 1 && y = 1 then
    result topleft
elsif x = 2 && y = 1 then
    result topmiddle
elsif... you get the idea
end getVariable


Write a similar function called 'setVariable' that accepts an x, y & a value and assigns that value to the proper variable and you can write the program just like you were using arrays.
Joy




PostPosted: Thu Jan 15, 2015 9:21 am   Post subject: RE:Tic Tac Toe Help

My instructor is expecting us to use simple code, because this a beginners class. Unfortunately, we haven't used functions either. Is there a way to do this using simple turing code? Thanks, you reply is very much appreciated.
Insectoid




PostPosted: Thu Jan 15, 2015 10:24 am   Post subject: RE:Tic Tac Toe Help

The simpler you try to make it, the harder it will be.
asdfasdf123




PostPosted: Thu Jan 15, 2015 11:40 am   Post subject: Re: Tic Tac Toe Help

I made a fairly simple tic tac toe game a while ago. Hope this helps.


tttSimulation.t
 Description:

Download
 Filename:  tttSimulation.t
 Filesize:  863 Bytes
 Downloaded:  237 Time(s)

Joy




PostPosted: Fri Jan 16, 2015 10:22 am   Post subject: RE:Tic Tac Toe Help

This helps but it has to be user controlled. Maybe if statements and such? Im sorry, Im just really stuck and cant figure out how to do this Sad
Joy




PostPosted: Fri Jan 16, 2015 10:50 am   Post subject: Re: Tic Tac Toe Help

This is what I have so far, I cant figure out why the O's don't show up.


Computer Studies Summative.t
 Description:

Download
 Filename:  Computer Studies Summative.t
 Filesize:  6.36 KB
 Downloaded:  198 Time(s)

Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: