Kabir Shah

Ranch Hand
+ Follow
since Aug 04, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kabir Shah

@mich

what exactly is a border?
I have made an array called as x and y.
It contains parameters which will help me search in all 8 directions.


I wrote print statements where ever I think its going to be confusing,typically the alpha and beta values.
I remove the print statements before posting the code here.so that the length decreases and people can draw their own conclusion.
Basically the length decreases dramatically. and it helps to understand the code better to people over here. when they cannot compile and see the output themselves.


# You have no debugging code in your program - I'm guessing you're just assuming the program is playing correctly?

I only commented about the debugging again because there is no debugging in your code. If there had been debugging and it didn't spot any issues then you need to improve how your debugging skills before progressing.



I guess by debugging code you mean writing print statements, my program works correct as of now.
You too tried to play against my applet, though the applet is still in premature state, I am pretty sure it followed basic criteria of game i.e connect4 or stop opponent from connecting 4. so I guess my program is playing correctly.

Am I missing something?

13 years ago
@Mich

I simply get frustrated pointing out the same issues in your code each time and seeing very little effort on your part to fix anything. In fact many of the issues



Well in that case, You are completely wrong, I try my best but then too if I am unable to fix it up then I post it here.

I pointed out on the 5 April in this thread are still issues in your code. There is also no obvious attempt at debugging in your code and I feel that even a minimum amount would highlight where your program has gone wrong.



In that post it was about negamax and not of evaluations. I fixed it up long time before.

I think I'll just leave you in Fred's capable hands.


Fred was a very helpful guy.
If given a chance,I still want to work with Fred,only difference is now I can devote more time to programing and also can experiment with my code so that only final things I verify with Fred.

I don't know what conversation has taken place between you and fred and what has he told about me.
13 years ago

Data driving your code means controlling the action of your program through data rather than through hundreds of if statements. In this particular case you have loads of lines of code that check for lines of 3 in each direction and then again for each different position a hole can be found in - in your case half the checks are missing so the code would be twice as long if it was complete. Better would be to have a small loop for each of the different directions and simply count the pieces from each square and out in each direction. If there's 3 of your pieces and a gap on that line then you get the bonus score.



I was reading on that so now I made some provision of checking in all possible directions.

You should also read up on how to debug code - the general idea is to print out debugging info that helps you work out what's wrong. You won't learn much by dumping your program on a forum and asking others to debug your code for you



Well again I think you are not getting the point. I posted (well 'dump' is not a correct word here,it shows the attitude that you have towards beginner programmers.) the code in this forum after trying a lot from my side,but failed every time.So I thought of asking whether I am making mistake in approach of coding(I am new to game programing and its easy to make mistakes in recursion).
I have never asked any one to debug my code, but to just let me know why was the code behaving in such a way,(a piece of advice for you, please read the posts carefully.),even after putting print statements, I was unable to see the reason.

and you certainly won't get much respect if you then point out your helpers mistakes


Obviously If 'helpers' try to help some one without actually bothered to read the question, then the 'helper' is not being helpful.
So its important to clarify and make it clear as what the person is really thinking of. But for that, the helper should read the post carefully


An added benefit of data driving the above code would be a much smaller amount of code which would then be easier to debug.


Ya, I can see that now, thanks for this point.
13 years ago
@Mich
I think you have misread the post and my game as well.
The game is 4-4 4-4 4-4 5-3


so now reply should be


but it plays in 5.

but I have alreaded wrote condtion for YYY_ which is applicable here,then why is it not following?
and what you mean by data driven program?
13 years ago
@Mich.

Yes this is still for connect 4.
and yes the some code is missing as well.
Here is the entire code.
Code
I am trying this step by step so that I create less bugs(one day I will reach to a stage where I create no bugs!(dream...)).
I tried with following move order- 4-4 4-4 4-4 5-3 (Now it should play 6 because it gets 3 in the bottom row, but it plays 5 returning the value 0 instead of 999.
13 years ago


This is a method which is written for returning proper values,according to conditions.
here the variable score is for seeing three in a row.

With this code,even if I allow computer to get three in a row, it does not play that move.
but instead if I write this way, it works.



Why does this happen?
13 years ago
well I am not a othello player, so I cannot judge your game, but it beats me straight out.
13 years ago

I was intending on matching your program against mine for a few games and seeing how they faired but your current interface needs a fair bit of work and I'd suggest the following at the very least:
# Only allow legal moves to play
# Allow the user to take moves back
# Indicate graphically where the computers move was
# Allow the user to change the level or depth of search
# There is a text box at the bottom which seems to do nothing
# I'd include a random element which to make it a bit less predictable - your's opens in the centre every time
# It should definitely auto play




This will take some time tough to implement as currently I am thinking to improve the evaluation methods. You made a point that

I'd include a random element which to make it a bit less predictable - your's opens in the centre every time


but we all know that player 1 always wins iff he plays in center,not anywhere else.

# It should definitely auto play


Why auto play mode, I really did not get this point of yours?

# There is a text box at the bottom which seems to do nothing


The text box has the purpose of displaying moves and other things, for debugging purposes, I put an equivalent statement for System.out.println(), to display it on the text area, so that its easier for me to see what is going on.

I assume this must be because more analysis is done of each board position when scoring.


This is exactly what I am talking about.The evaluation and scoring.
I made provisions to check three in rows and odd row threats, what else should I do?
The question is how did you go about the evaluations?
Do you mind to share its outline,or may be pseudo code with me
13 years ago
ok I have made an applet version which is too slow according to me.
Here it is: MY Connect-4 Applet
Just be careful that Human inputs should be legal,computer wont check them.
I have not added this feature yet to applet as of now. late on I will add it when I get a speedy applet.
The current depth is of 8plys.Also the applet is not auto playing, Press Play Button whenever you wish the computer to play.
13 years ago
@Mich

Thanks for replying.

Talking about the evaluations of my program. I have made some modifications, I made provision to search for three in a row as well so the computer sees if there is no 4 but three then play that move instead of any other, however I am not getting a perfect AI as player1, No doubt it plays strong,but there is still a difference between strong and perfect player.

In connect4, there are many confusing concepts. There are times when there is only one move which can win but after many moves (beyond the current dept of search.). take for the example of the following move order(4-1 4-4, these numbers are the column numbers). Now here only way to win is by playing in column 4. (Its obvious to dominate middle column, but its not obvious every time).

My program plays stronger,it beats online applets, also had 2-2 with yours.

Further if you can help me with evaluations, let me know what should I do in order to make it better.

I am yet to make it as an applet,that wont take much time though, this improvement is going on in AI part, which has got nothing to do with the GUI, so I thought rather to focus on strength than display.

So talking about the hash tables, what should be the preferable size of it?




13 years ago
Thanks for the replies.

I am doing few experiment games, in which I want to speed up my search.
so for example, I programed a chess game,
I start off with Negamax,then alphabeta,then killer heuristics and then hashtable at the most i can add opening moves.
But now the thing is even after doing this I wont be able to get a search depth of 30plys within few seconds, this is where i want my hardware to increase my speed.

So asking about that.
13 years ago