Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!

# Different board representation in connect4

Ashish Schottky
Ranch Hand
Posts: 93
In the applet given on this link,Connect4.
the author has used a different type of board representation

just had a doubt, is this a type bit-board representation?

This program works awesome.

Mich Robinson
Ranch Hand
Posts: 260
1
No.

Ashish Schottky
Ranch Hand
Posts: 93
@Mich

First of all thank you for taking time to reply to my post.

Can any one pleas explain me why did the author of this program choose numbers like 156,13 and what is so special in number'13' as field column is incremented by 13

Also then I found this confusing, I know this is related to directions but then I could only get 9.

u=up,d=down,l=left,r=right,ul=up-left(diagonal),ur=up-right(diagonal),dl=down-left(diagonal),dr=down-right(diagonal),tmp=temporary value.
Rest all, I couldn't get their directions, I guess its in the same language which is used for comments.
moreover, I am unable to understand the language that is used to comment. But program by itself is just too good...

The game which I am talking about is here Connect-4

Mich Robinson
Ranch Hand
Posts: 260
1
Ashish Schottky wrote:
Can any one pleas explain me why did the author of this program choose numbers like 156,13 and what is so special in number'13' as field column is incremented by 13

The 2 dimensional board is simply being stored within a 1 dimensional array.
The edges of the board are just marked with a border value.
Doing this is a good idea and I remember suggesting that you do this to (my post on 5 Apr)

Imagine this is the array holding the board below.
The # is part of the border.
The O and X are pieces played.
To look at a square above another square just add 13.
To hold the whole array requires an array of size 156.
I have no idea why the borders 3 pieces deep as this is very inefficient.

Ashish Schottky wrote:
Also then I found this confusing, I know this is related to directions but then I could only get 9.

These are variables to hold the number of squares to move in each direction when looking for possible lines.
He's using separate checks to look in each direction instead of just having one simple loop.
This results in much duplication in his code and again it's an inefficient method.
The field array just holds the next available move on any column.

Ashish Schottky wrote:
I am unable to understand the language that is used to comment.

That's because it's German - you can translate it using babel fish if you need to.

Ashish Schottky wrote:
But program by itself is just too good...

Really? it lost quite easily to me on the first game though it did play better on it's second game but it offers no facilities to change the level or take back moves or let the computer play first. Perhaps you'd do better copying all the code and just adding these features to it?

Ashish Schottky
Ranch Hand
Posts: 93
I just received an email, regarding a new post on this topic, however nothings new here since my last visit.
I kindly request admins to take a look at this.
iindia indian
is the member who posted something here,which I am unable to view.