Jump to content

Tic Tac Toe


Recommended Posts

I am making a Tic Tac Toe game and my buttons are like this all the way up to 9

$Button[1][1] = GUICtrlCreateButton("test" , 0 , 0 , 75 , 20)

What I don't is I am making them an array but why is it consider Down/Across.

My game checking works perfect I just want to understand why it works like this

$Button[1][1]

- the first [1] is consider down and the second [1] is consider across why is it like that, I got my game checking somewere in the forms I just copied it.

Link to comment
Share on other sites

I am making a Tic Tac Toe game and my buttons are like this all the way up to 9

$Button[1][1] = GUICtrlCreateButton("test" , 0 , 0 , 75 , 20)

What I don't is I am making them an array but why is it consider Down/Across.

My game checking works perfect I just want to understand why it works like this

$Button[1][1]

- the first [1] is consider down and the second [1] is consider across why is it like that, I got my game checking somewere in the forms I just copied it.

Which dimension in a 2D array is considered Row/Column, X/Y, or Down/Across is arbitrarily determined by how you use it. Since tic-tac-toe is played on an X/Y grid, the usual convention would be [$x][$y], where $x is across from left to right, and $y is down from top to bottom.

The top left corner is [0][0], the middle is [1][1], and the bottom right is [2][2] either way.

The top right corner would be [2][0] this way, and [0][2] if you chose the other way.

It will work either way as long as you are consistent within your script.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Which dimension in a 2D array is considered Row/Column, X/Y, or Down/Across is arbitrarily determined by how you use it. Since tic-tac-toe is played on an X/Y grid, the usual convention would be [$x][$y], where $x is across from left to right, and $y is down from top to bottom.

The top left corner is [0][0], the middle is [1][1], and the bottom right is [2][2] either way.

The top right corner would be [2][0] this way, and [0][2] if you chose the other way.

It will work either way as long as you are consistent within your script.

:)

I think I get it now, they act as a dimension as well as a array.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...