aspose file tools*
The moose likes Game Development and the fly likes Different board representation in connect4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "Different board representation in connect4" Watch "Different board representation in connect4" New topic
Author

Different board representation in connect4

Ashish Schottky
Ranch Hand

Joined: Dec 29, 2009
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

Joined: Jun 28, 2009
Posts: 250
    
    1
No.



Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
Ashish Schottky
Ranch Hand

Joined: Dec 29, 2009
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

Joined: Jun 28, 2009
Posts: 250
    
    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

Joined: Dec 29, 2009
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.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Different board representation in connect4
 
Similar Threads
Can some body help debug!!!!
Having NullPointerException Error in Connect4
Having problems in unMakeMove() for chess
what is "literal" means ?
Turn Based Strategy Games