Sign in to follow this  
Followers 0
JellyFish666

Tic Tac Toe

3 posts in this topic

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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0