Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Is This Looping Forever?

loop

  • Please log in to reply
17 replies to this topic

#13 ultimate99

ultimate99

    CC Newcomer

  • New Member
  • PipPip
  • 10 posts

Posted 28 April 2012 - 08:46 AM

Are you asking how to map numbers 1-9 to row and column? Something like the following
subtract 1 and
% by number of columns to get column
/ by number of rows to get row


Yes, exactly! An output that would like this:
Game board:
[1][2][3]
[4][5][6]
[7][8][9]

and when player or computer plays, it appears like this:
Game board:
[X][2][3]
[X][O][6]
[O][8][X]

Does this involve a lot of modifications to the current code?
  • 0

#14 Norm

Norm

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 397 posts
  • Location:Eastern Florida
  • Programming Language:Java, C++, Assembly

Posted 28 April 2012 - 08:50 AM

I have not looked at the code. Take a look and see what changes it would require.
  • 0

#15 ultimate99

ultimate99

    CC Newcomer

  • New Member
  • PipPip
  • 10 posts

Posted 28 April 2012 - 09:23 AM

I have not looked at the code. Take a look and see what changes it would require.


Yeah, that's what I've trying to figure out; what changes would it require? :laugh: :confused:
  • 0

#16 Norm

Norm

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 397 posts
  • Location:Eastern Florida
  • Programming Language:Java, C++, Assembly

Posted 28 April 2012 - 09:26 AM

Post what the program is currently printing out and add comments to it showing what you want it changed to.

Look in the code to see where it is creating the output you want to change. Then work on how to change it so it outputs what you want.
  • 0

#17 ultimate99

ultimate99

    CC Newcomer

  • New Member
  • PipPip
  • 10 posts

Posted 28 April 2012 - 10:49 AM

The output currently is:

Welcome to TicTacToe
0 1 2
0	|   |  
---+---+---
1	|   |  
---+---+---
2	|   |  

Choose a symbol: X or O

I want it to be changed to:


Welcome to TicTacToe

Game board:
[1][2][3]
[4][5][6]
[7][8][9]

  • 0

#18 Norm

Norm

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 397 posts
  • Location:Eastern Florida
  • Programming Language:Java, C++, Assembly

Posted 28 April 2012 - 10:54 AM

Are you the programmer that wrote the code you want to change?
Have you found where the current code prints out what you want to change?


The code you have posted does not compile without errors.
Can you post the current version you have that does not have compiler errors?

Look at the buildGridString() method in the first version of the code you posted and have deleted.
It is very easy to modify to get what you want:

[1] [2] [3]
[4] [5] [6]
[7] [8] [9]
  • 0





Also tagged with one or more of these keywords: loop

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download