ChessPlusPlus progress

Pages: 12345
L B wrote:
Also, @Disch is this your account?


Yes it is, but I had forgotten all about it. I think I only signed up to post that thing on the SFML board.
@MiiNiPaa: yeah, I had forgotten that. I've made a workaround that checks the GCC version.

Unfortunately for me I'm on Windows so clang uses whatever headers were used by the compiler that built it, so migrating to clang would be nice but libc++ is not ported to Windows.

Also, if you have a 64-bit machine, you can sue nuwen MinGW which includes pre-built boost:
http://nuwen.net/mingw.html
Last edited on
How about
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include<boost/date_time/posix_time/posix_time.hpp>
...
 static std::string timestamp()
        {
            using namespace boost::posix_time;
	    std::time_t curr_time_raw = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
	    std::tm *lt = std::localtime(&curr_time_raw);

            std::stringstream time;
            time << "[" << to_simple_string(time_duration(lt->tm_hour, lt->tm_min, lt->tm_sec)) << "]" << std::endl;

            return time.str();    
        }

	
Last edited on
I have a preference for using the standard C++ way unless it's more complicated than the boost way - we should discuss what to do about this particular instance though.
Seems like a pretty viable option to me. Boost is already a dependency and std::put_time doesn't work in GCC yet, so why not use boost?
If you want a simple timestamping function, you can use this: http://codepad.org/9GXyZvRN

The default parameters should be fine for almost all cases.

[edit] About the format string:
H - insert hours (24-hour)
h - insert hours (12-hour)
m - insert minutes
s - insert seconds
? - insert a.m. or p.m.
\\ - escape following character (e.g. "\\H" => "H")
Anything else in the format string gets copied verbatim.
Last edited on
@chrisname I think you're trolling me. Hand-writing your own implementation when both the C++ standard library and boost provide existing solutions that work just as well?

@naraku: I'll replace the "no std::put_time" code with the boost code and keep both variants of the code (both the std::put_time variant and the boost variant) - is that OK?
Last edited on
As for the game itself, I'm close but not quite there with preventing certain pieces from jumping over:
http://i.imgur.com/PaKgAOA.png
As you can see the capturing field extends too far, but at least the trajectory field stops like it should.

EDIT: Oh, and I fixed the thing with the black pawns not being able to capture diagonally down-right - it was a bug in Position::move (I had mapped the wrong coordinate offset to SouthEast).

EDIT: OK, things are getting weird. I've no idea what I broke:
http://i.imgur.com/YvgfgW7.png
http://i.imgur.com/iZsE8fe.png
I've also had a pawn (but just that pawn) able to capture arbitrary pieces completely across the board. I can't reproduce some of this.

EDIT: haha, it's because I wasn't clearing the capture positions.
Last edited on
Has issues but really I have to say nice work. Chess is a WAY harder game to code than many would originally credit it to be. Especially for AI components. Keep up the good work!
Networked chess doesn't need AI ;)
Ok, boost, now you just playing with me: I woke up to another crash. That time it was when compiling threading library (I think). Now I will set in to compile only filesystem and system and turn off precompiled headers.
Now I have compiled both boots and project. Averything is set up and I can work on it.

BTW is this the correct way to apply changes from the original repositiry?
$ git pull upstream cmake
Where upstream is the cplusplus' repository
Is it almost finished? :D
devonrevenge wrote:
Is it almost finished? :D

By the looks of it... In a word? No. I'd say he has quite a bit of work left before it is finished. Though, it is looking great.
This looks amazing. What are you using for graphics?
toad1359 wrote:
What are you using for graphics?

SFML
Thanks MiiNiPaa.
@MiiNiPaa
git fetch upstream #so you can see what canged
git merge upstream/cmake #to merge with upstream
If you worked on your own repository from another computer and made commits (but didn't push) on this computer:
git fetch origin #to see what changed
git pull --rebase #will interleave commits in the proper order
Last edited on
By the way, is everyone able to build on their system?

I've only been able to test on Windows 7 64 bit with nuwen MinGW, but just now I tested on Windows Vista 32 bit with a normal MinGW installation:
http://i.imgur.com/wLhhMJ7.png
Had to build boost and SFML but after that it built just fine.

Just say whether you can build or not and what OS/compiler combination. I've not yet been able to link with clang but it can compile.
Win 7 x64 with 64 bit MinGW.
Version from cplusplus repository
Builds fine. Had to wiggle with json library: it tries to store 64bit pointer in 32bit integer
Pages: 12345