Hi,
I'm trying to make a little chess game,
in C++, is in terminal because still I don't know a good GUI package for C++ sorry I'm n00b...
btw I got to print out the board:
like this: [code]
-|--a-|--b-|--c-|--d-|--e-|--f-|--g-|--h-|
8|-bR-|+bk+|-bB-|+bQ+|-bK-|+bB+|-bk-|+bR+|
7|+bP+|-bP-|+bP+|-bP-|+bP+|-bP-|+bP+|-bP-|
6|----|+--+|----|+--+|----|+--+|----|+--+|
5|+--+|----|+--+|----|+--+|----|+--+|----|
4|----|+--+|----|+--+|----|+--+|----|+--+|
3|+--+|----|+--+|----|+--+|----|+--+|----|
2|-wP-|+wP+|-wP-|+wP+|-wP-|+wP+|-wP-|+wP+|
1|+wR+|-wk-|+wB+|-wQ-|+wK+|-wB-|+wk+|-wR-|
[\code]
and one can tell like in chess with the sentence "(e2:e4)" to move the piece from e2 to e4
but now what I need to make a AI?
I'll paste the code in pastebin so you can have a look:
Chess AI??
No wai.
You mean one that doesn't move chess pieces randomly?
(It's AI too, that's how I usually for the first few moves play)
I can only contribute simple ones.
Search algorithm, makes some move permutations for the next 3-4 moves(fuckload complexity) and put some weights on taking a figure + (weight for different figures) and - for losing a figure
This should be good enough for any CS 101 course, unless your program is gonna play against Bobby Fischer(btw he's dead)
Or just hardcode all possible moves(lol).
Name:
Snake4D2012-01-11 12:55
>>12
>Or just hardcode all possible moves(lol).
hardway...
btw a simple one that moves pieces like you said is great... do I need something in particular? or store the moves in a boolean board will work?
Name:
Anonymous2012-01-11 12:56
Why don't you just get a github account or something to that effect instead of spamming a bunch of pastebin links?
I think it's easier to just write the chess program itself, the AI, and the GUI as three different things. After that, you can just link everything together using getters and setters.
>>23
Have you ever read SICP? If so, the books talks about this model. Now just extend this basic idea to what you're doing. If not, then I guess I'd have to agree with the regulars here and tell you "Read SICP."
>>25
Kodak, this is your daily reminder that the statement every subset of a countable set is also countable is absolutely true, never fails and is mathematically proven.
OP, read xboard protocol - you don't need to write gui.
Cool story time:
I tried to write chess AI once, even connected it to xboard and tested on several Guests at FICS Guess what, it appeared that opening books ARE important, as guests were not patient enough to wait while my almighty AI calculated start position score to start with its favorite Nf3. On the bright side my AI is undefeated after 3 games since people aborted the game at turn 1.
Name:
Anonymous2012-01-11 13:27
>>27
I really think the OP would have an easier time with this project if he had read/absorbed the stuff in SICP.
>>31
I have a yahoo checkers AI program that can defeat pretty much defeat anyone is less than a minutes. Seriously. I actually have this thing running in Badger Bridger right now.
>>38
The checkers AI engine that I use on Yahoo needs both a strong opening engine and a strong closing one. For reasons that I don't understand, I can't have both.
Name:
Anonymous2012-01-11 13:39
Kodak seems a lot less suicidal today, I think he has taken his pills.
So Kodak is being nice and helpful. Some other dude is spamming a thread about undefined behavior. Nobody is being called mental midgets who should scrub another toilet, tell me, is this bizarro /prog/?
>>46
The weird part is that the imageboards are up.
On topic:
Since op is doing it in a terminal means its super-basic.
He should just make something that moves the pieces randomly
unless a piece can score or is in imminent peril.
>>49
Excluding 'in-house' testing.
Silly embedded software.
Basic school projects.
When was the last time you made a purely console app requiring more than 3 inputs?
>>50
A lot of OS's make a distinction between the terminal and the console. But I wouldn't expect a mental midget like yourself to know such a subtle, but important difference.
>>53
This is like the time with char[] not being a string.
So discerning blue from indigo is the only thing you get right.
Are you by any chance a woman?
Name:
Anonymous2012-01-11 14:18
appropriately named chess engine is appropriate: -
>>57
Also, what happens if the underlying device is a socket()? How do you see fucking output? That is why some operating systems make a distinction between the terminal and the console.
Again, you're stupid. And again, you have no real future as a computer programmer.
>>63
More on less, in C, a string is an array of characters followed by a '\0'. In this case I don't have a '\0'. Therefore it's not a string. Now shut up and quit arguing with me. Unlike you, I work as a programmer.
>>60
Look, that does not change the fact that in most(alert:inaccurate term) cases char[] represents strings and as such can be reffered to in that manner.
Also
[x] Likes attention
[x] Evades inconvenient anwsers
[x] Overemphesizes subtle differences
[x] Vengful Hell hath no fury like a kodak scron
[x] Never admits being wrong.
kodak is gurl, srsly, my waito knights instinct cannot into arguments with gurls, so I concede defeat.
>>74
But you keep asserting "char[] represnts strings" as absolute truth, when in realiy isn't. Again, you're stupid. And again, I don't think you have any possible future as a computer programmer.
Name:
Anonymous2012-01-11 14:57
>>72
Did Kodak just admit to being wrong? That's a small step for Kodak-san and a huge leap for /prog/.
>>84
Yeah, homeboy finally accepted the fact that he was too dumb to become a computer programmer, so he went back to his former job of being the president of NAMBLA.
>>88
I don't about C++, but at least in Java, there are tools that make building a GUI a breeze. All that's involved is just clicking a form button, and then using the drop and drag feature to resize and move things around. Hell, even the moron computer science major who can't seem to land a programming job could do it.
Name:
Anonymous2012-01-15 22:02
There at two checker AI bots doing battle at table 22 in Amoeba Room on Yahoo Checkers
the whole problem with move eval in chess (more or less) goes something like this;
To evaluate one first move, you kind of need to look at the opponents next (possible) move(s)... and then to see if his move(s) is/are really any good, you need to step ahead again, ...etc, etc, and this is known as the 'horizon effect'
just to illustrate, the first four moves can produce this number of unique boards (starting at the zeroth move) 1 > 21 > 421 > 5623 > 75321 (^^ as calculated by me & my boxz ;) // ignoring all duplicate boards but summing all previously seen.. eg the first move has only 20 actual outcomes