FacebookTwitter
Hatrack River Forum   
my profile login | search | faq | forum home

  next oldest topic   next newest topic
» Hatrack River Forum » Active Forums » Books, Films, Food and Culture » Blayne's Multiplayer Chess Engine (Completed! Dec-9) (Page 1)

  This topic comprises 3 pages: 1  2  3   
Author Topic: Blayne's Multiplayer Chess Engine (Completed! Dec-9)
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
My marks have been kinda poor in my networking course so we have a choice of 3 projects with different marking schemes.

easy: tic tac toe 7.5/10
medium: connect 4 10/10
ambitious: othello 12.5/10

basically we already have these games but we have to network them so 2 people on different terminals can play together.

If were really ambitious we can make a multiplayer capable chess game. 15/10

Should I try the very ambitious one to gain the extra 5 marks?

*update buttom of page*

[ December 09, 2007, 08:02 PM: Message edited by: Blayne Bradley ]

IP: Logged | Report this post to a Moderator
Noemon
Member
Member # 1115

 - posted      Profile for Noemon   Email Noemon         Edit/Delete Post 
Depends on how confident you are that you'll be able to pull it off, how long it'll take you to do so, and how badly you need the extra 5 marks.
Posts: 16059 | Registered: Aug 2000  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
You already have these games written for two local players? Any of these should be trivial, if all that is required is making them networkable.
Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
TomDavidson
Member
Member # 124

 - posted      Profile for TomDavidson   Email TomDavidson         Edit/Delete Post 
It's odd that your networking course would score the games that way, since the networking code for each will be nearly identical.
Posts: 37449 | Registered: May 1999  |  IP: Logged | Report this post to a Moderator
Dagonee
Member
Member # 5818

 - posted      Profile for Dagonee           Edit/Delete Post 
If you have the chess logic, making it networkable is trivial. I know - I've essentially done it.
Posts: 26071 | Registered: Oct 2003  |  IP: Logged | Report this post to a Moderator
Mucus
Member
Member # 9735

 - posted      Profile for Mucus           Edit/Delete Post 
The best choice depends. Which choice will minimize the number of questions that you'll post on this forum regarding debugging? [Wink]
Posts: 7593 | Registered: Sep 2006  |  IP: Logged | Report this post to a Moderator
NotMe
Member
Member # 10470

 - posted      Profile for NotMe   Email NotMe         Edit/Delete Post 
Write the code for Tic-Tac-Toe so that you have something to turn in, then make a backup and start extending it to Othello.

If that works well, move on to Chess.

Posts: 145 | Registered: Apr 2007  |  IP: Logged | Report this post to a Moderator
Noemon
Member
Member # 1115

 - posted      Profile for Noemon   Email Noemon         Edit/Delete Post 
quote:
Originally posted by NotMe:
Write the code for Tic-Tac-Toe so that you have something to turn in, then make a backup and start extending it to Othello.

If that works well, move on to Chess.

Very good advice.
Posts: 16059 | Registered: Aug 2000  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
Im going to do Chess since I actually have a partner for this now yay!
IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
the networking would be nearly identicle but the code for the games themselves isn't nessasarily so, we'v never done a chess game b4 thus making it the hardest choice, while we've done, tictacttoe in vb, and connect and othello with c++.
IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
I thought you said you already had those games.

Heh, it always feels weird to see people writing the checking routines for these games in procedural (or even functional) code, when for most of the checking, the logic would be much better expressed in a logical programming language, such as Prolog, that you can run embedded, or with a logical programming library (which exist for just about every programming language).

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Launchywiggin
Member
Member # 9116

 - posted      Profile for Launchywiggin   Email Launchywiggin         Edit/Delete Post 
Chess is a much better game, but Othello is one of those that I can actually play with my family.
Posts: 1314 | Registered: Jan 2006  |  IP: Logged | Report this post to a Moderator
Itsame
Member
Member # 9712

 - posted      Profile for Itsame           Edit/Delete Post 
Is your program going to be able to function as an engine? If so I want to play it after you turn it in. :-D
Posts: 2705 | Registered: Sep 2006  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
Alright status report time:

We went for chess as Cyric much prefers chess and undestands the game better.

We basically have a header file with structures where we have all our functions, main just calls them.

We have a function for creating the board, and placing pieces on the board, and functions dealing with determining if a move is valid and some obstacle checking, I so far helped mosly with figuring out bugs, and typed up the function dealing with valid move checking and obstacle checking. All and all good days work.

The way its going to work is that when you start up 2 clients you enter your move, if valid its transmited to update your opponents game and vice versa using a server packet program.

i think we're also going to have the option to have any number of observer clients.

IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
So ya, as it turns out I am really good at begugging C++.

code:
bool validPath( int ox, int oy, int tx, int ty, side_t oSide  )
{
if(oSide == WHITE)
{
for ( int c = oy+1; c < ty; c++ )
{
if ( board[oy][c].itsType != EMPTY )
{
return false;
}
}
return true;
}
if(oSide == BLACK)
{
for ( int c = oy+1; c < ty; c-- )
{
if ( board[ox][c].itsType != EMPTY )
{
return false;
}
}
return true;
}
}

I would say 10 minutes time spent figuring why this was wrong if i dont count the time watching Bleach.

Basically the castle upon testing would work with full functionality with verticle movement, but would epicly fail horizontally.

After stepping through the debugger a couple of times I have determined that when I wrote this code originally it was incomplete and was not meant to work with horizontal movement correctly.

My partner spent and as he would undoubtably put it "wasted" probably a LOT of time on this trying to figure it out and couldn't.

He's going to kill me when he reads my email about his. He doesn't like it when I make these silly mistakes.

[Smile]

IP: Logged | Report this post to a Moderator
Flaming Toad on a Stick
Member
Member # 9302

 - posted      Profile for Flaming Toad on a Stick   Email Flaming Toad on a Stick         Edit/Delete Post 
quote:
Originally posted by Blayne Bradley:
So ya, as it turns out I am really good at begugging C++.

Really? Could you teach me?
Posts: 1594 | Registered: Apr 2006  |  IP: Logged | Report this post to a Moderator
Itsame
Member
Member # 9712

 - posted      Profile for Itsame           Edit/Delete Post 
Don't forget Castling, promotion, and en passant. Not to mention 3 move repetition, stalemate, 50 move rule, etc. Oh, and not just promotion to a Q, but underpromotion.
Posts: 2705 | Registered: Sep 2006  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
We decided that going into all of the more trivial rules of chess would not get us additional marks, so we are designing straight up chess, you can move a piece, it will check if its a valid move, and if valid it will move the piece, if there's an enemy piece it will take the peiece.

And we'll have check/checkmate logic but that is as far as we go.

IP: Logged | Report this post to a Moderator
Nighthawk
Member
Member # 4176

 - posted      Profile for Nighthawk   Email Nighthawk         Edit/Delete Post 
You don't need "if(oSide == BLACK)" when an "else" will do the same. Also, in that case you don't even need the "if" at all, but I guess you can keep it for readability's sake.

quote:
Don't forget Castling, promotion, and en passant. Not to mention 3 move repetition, stalemate, 50 move rule, etc. Oh, and not just promotion to a Q, but underpromotion.
This would be the only reason why chess would be scored higher; if it weren't for these complexities, like it's been said, why would it be worth more? Making it a "straight up" game is no different than doing Othello. There's got to be more to it than just determining valid moves.
Posts: 3486 | Registered: Sep 2002  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
because othella, ttt, and connect4 are all a matter of copy and pasting since we did them already in previous semesters, Chess is the only one that requires work its not trivial either.
IP: Logged | Report this post to a Moderator
Noemon
Member
Member # 1115

 - posted      Profile for Noemon   Email Noemon         Edit/Delete Post 
Hey, Blanye, I appreciate your updating the existing thread on the subject rather than starting a new one. Thanks.
Posts: 16059 | Registered: Aug 2000  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
What does oSide indicate in your parameter list?
Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
if its whites pece or blacks.
IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
If you just added the movement checks for horizontal movement, you might verify it works in both directions. The version you pasted above wouldn't work in both directions.

In fact, you might ponder if there's any difference in the move capability for a white rook or a black rook, and what implications that has for having separate checks for white and black.

Also, do your checks let someone take their own pieces?

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
TomDavidson
Member
Member # 124

 - posted      Profile for TomDavidson   Email TomDavidson         Edit/Delete Post 
quote:
We decided that going into all of the more trivial rules of chess would not get us additional marks, so we are designing straight up chess
You realize that trivial rules are not the same thing as optional rules, right? [Smile]
Posts: 37449 | Registered: May 1999  |  IP: Logged | Report this post to a Moderator
King of Men
Member
Member # 6684

 - posted      Profile for King of Men   Email King of Men         Edit/Delete Post 
I would certainly mark people down for not having all the rules; but there's such a thing as prioritising. Get the main rules first, then the networking. Heck, get something that draws the booard for both players and moves pieces around, to hell with the rules. Then begin adding stuff to the logic.
Posts: 10645 | Registered: Jul 2004  |  IP: Logged | Report this post to a Moderator
Itsame
Member
Member # 9712

 - posted      Profile for Itsame           Edit/Delete Post 
quote:
Originally posted by Noemon:
Hey, Blanye, I appreciate your updating the existing thread on the subject rather than starting a new one. Thanks.

... now this may be rude, but screw you.

quote:
Originally posted by TomDavidson:
quote:
We decided that going into all of the more trivial rules of chess would not get us additional marks, so we are designing straight up chess
You realize that trivial rules are not the same thing as optional rules, right? [Smile]
Indeed, if I were to play a game of chess online via the program, and it lacked any one of those rules, I would stop using the server immediately, without a second thought. It changes the game completely without any one of them.
Posts: 2705 | Registered: Sep 2006  |  IP: Logged | Report this post to a Moderator
Nighthawk
Member
Member # 4176

 - posted      Profile for Nighthawk   Email Nighthawk         Edit/Delete Post 
What level of graphics work do you need to do for this sort of app? Granted, I'm not expecting a D3D application like the one that comes with Vista, but I also don't know how much to expect of students as far as graphics work in a rather basic programming course, especially one that isn't about graphics work in the first place.
Posts: 3486 | Registered: Sep 2002  |  IP: Logged | Report this post to a Moderator
Noemon
Member
Member # 1115

 - posted      Profile for Noemon   Email Noemon         Edit/Delete Post 
quote:
Originally posted by JonHecht:
quote:
Originally posted by Noemon:
Hey, Blanye, I appreciate your updating the existing thread on the subject rather than starting a new one. Thanks.

... now this may be rude, but screw you.
Yeah, that's definitely rude. What prompted your comment, Jon?
Posts: 16059 | Registered: Aug 2000  |  IP: Logged | Report this post to a Moderator
El JT de Spang
Member
Member # 7742

 - posted      Profile for El JT de Spang   Email El JT de Spang         Edit/Delete Post 
Oversensitivity. He thinks that your comment is a dig at him, which is ludicrous and not just a little paranoid.
Posts: 5462 | Registered: Apr 2005  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
code:
[BC][BKn][BB][BQ][BK][BB][BKn][BC]
[BP][BP][BP][BP][BP][BP][BP][BP]
[ ][ ][ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ][ ][ ]
[WP][WP][WP][WP][WP][WP][WP][WP]
[WC][WKn][WB][WQ][WK][WB][WKn][WC]

These are the awesome grpahics we currently have.

Also King of Men, me and Lurken may have found a compromise in rgeards to our issue.

IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
But ya we are rather certain that our teacher will not award extra marks for noting down every concievable rule the point of the thing is to have a game working via the network, the diffulty being which game the teams choose to do.
IP: Logged | Report this post to a Moderator
MattP
Member
Member # 10495

 - posted      Profile for MattP   Email MattP         Edit/Delete Post 
It's not like implementing those rules is particularly hard once you've done everything else. I'd do them just for the sake of pride, if nothing else.
Posts: 3275 | Registered: May 2007  |  IP: Logged | Report this post to a Moderator
Nighthawk
Member
Member # 4176

 - posted      Profile for Nighthawk   Email Nighthawk         Edit/Delete Post 
I have to ask: "C" is for... rook?
Posts: 3486 | Registered: Sep 2002  |  IP: Logged | Report this post to a Moderator
The Flying Dracula Hair
Member
Member # 10155

 - posted      Profile for The Flying Dracula Hair   Email The Flying Dracula Hair         Edit/Delete Post 
Is it silly to call it a Castle? I still call them Castles.
Posts: 299 | Registered: Jan 2007  |  IP: Logged | Report this post to a Moderator
Itsame
Member
Member # 9712

 - posted      Profile for Itsame           Edit/Delete Post 
It makes me cringe whenever anyone calls the rooks castles.

Edit:

Blayne, without these "extra rules" all pawn endgames would be a draw. How silly is that?

Posts: 2705 | Registered: Sep 2006  |  IP: Logged | Report this post to a Moderator
Noemon
Member
Member # 1115

 - posted      Profile for Noemon   Email Noemon         Edit/Delete Post 
Hey, Jon, I'm still curious about the "screw you" comment.
Posts: 16059 | Registered: Aug 2000  |  IP: Logged | Report this post to a Moderator
Itsame
Member
Member # 9712

 - posted      Profile for Itsame           Edit/Delete Post 
My apologies, misunderstanding.
Posts: 2705 | Registered: Sep 2006  |  IP: Logged | Report this post to a Moderator
King of Men
Member
Member # 6684

 - posted      Profile for King of Men   Email King of Men         Edit/Delete Post 
quote:
Originally posted by Blayne Bradley:
Also King of Men, me and Lurken may have found a compromise in regards to our issue.

There is no compromise that involves me and Ego playing in the same game. If you have a different solution, by all means let's hear it. I do note, I am not discussing this. I tried to be reasonable for six weeks. I laid out my reasoning. I swallowed insults. I asked Ego to consider whether his non-native English might cause problems even where he didn't intend them. I've had it. If you want to play a game including me, it will not include Ego. If you prefer to continue the game we've got, it will not include me short of Ego getting banned. There is no argument you can make that will lead to me playing in the same game with Ego, so don't even start.
Posts: 10645 | Registered: Jul 2004  |  IP: Logged | Report this post to a Moderator
Noemon
Member
Member # 1115

 - posted      Profile for Noemon   Email Noemon         Edit/Delete Post 
Are you sure, KoM? Because you don't sound sure.
Posts: 16059 | Registered: Aug 2000  |  IP: Logged | Report this post to a Moderator
King of Men
Member
Member # 6684

 - posted      Profile for King of Men   Email King of Men         Edit/Delete Post 
I am not, at this point, having much of a sense of humour on this subject. This used to be a fun game. It's not anymore, and I'm pissed.
Posts: 10645 | Registered: Jul 2004  |  IP: Logged | Report this post to a Moderator
Itsame
Member
Member # 9712

 - posted      Profile for Itsame           Edit/Delete Post 
*totally lost*
Posts: 2705 | Registered: Sep 2006  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
The compromise was about something completely unrelated to Ego KoM

[ December 01, 2007, 11:59 PM: Message edited by: Blayne Bradley ]

IP: Logged | Report this post to a Moderator
King of Men
Member
Member # 6684

 - posted      Profile for King of Men   Email King of Men         Edit/Delete Post 
I've already asked you not to use my name on the forums. Also, you are not making any sense.
Posts: 10645 | Registered: Jul 2004  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
I wasn't aware/didn't remember that, my apologies.

Did you not read Lurkens pm?

IP: Logged | Report this post to a Moderator
King of Men
Member
Member # 6684

 - posted      Profile for King of Men   Email King of Men         Edit/Delete Post 
I did. If there was anything non-Ego-related, Lurken did not speak of it.
Posts: 10645 | Registered: Jul 2004  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
I told him I would join your new game if China would be unnerfed in EU and I'm giving back the GM-ship I should have had but Sterk somehow managed to take from me. All of this entirely ego-unrelated.

Lurken agreed that these would be acceptable since I am not Ego and I do not power game, in CK i'm lucky to have my realm not implode.

IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
Although I think this is all moot ego I beleieve is resigning for the good of the game.
IP: Logged | Report this post to a Moderator
HollowEarth
Member
Member # 2586

 - posted      Profile for HollowEarth   Email HollowEarth         Edit/Delete Post 
Eh I would seriously consider switching from using Kn for knights to something else, anything else, since everything else is 1 character.

I think gnu chess has a command line board, does anyone know what they do?

Posts: 1621 | Registered: Oct 2001  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
Wow, my code for determining if your in check is around 400 lines of code.
IP: Logged | Report this post to a Moderator
  This topic comprises 3 pages: 1  2  3   

   Close Topic   Feature Topic   Move Topic   Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:


Contact Us | Hatrack River Home Page

Copyright © 2008 Hatrack River Enterprises Inc. All rights reserved.
Reproduction in whole or in part without permission is prohibited.


Powered by Infopop Corporation
UBB.classic™ 6.7.2