Author: Lance Perkins
Date: 00:36:32 09/07/05
I have ported crafty to run on MobileThinkerBoard.
The ChessThinker download now has the new Pocket PC UI, the MobileThinker engine
and the MobileCrafty engine. There should be a tournament mode soon. You should
also now be able to use your normal ICC account. The UI can now be modified
through a config file to specify piece fonts, board colors, and layout of the
windows.
To port your "Winboard" engine to run on MobileThinkerBoard, you only need to
make a few changes - all listed below.
Remeber, the protocol is still xboard. Only the IO method has changed - since
your code now runs on WinCE which does not support pipes.
// ---------------
// 1st:
// add something like this to your chess.h source file
#if UNDER_CE
#define InputReady() (input_available(IOInst))
#define gets(s_) (get_string (IOInst, s_, 512))
#define printf PrintF
extern int __cdecl PrintF(const char *, ...);
extern void *IOInst;
extern int (__stdcall *input_available) (void *pInst);
extern char * (__stdcall *get_string) (void *pInst, char *s, int nmaxlen);
extern void (__stdcall *put_string) (void *pInst, const char *s);
#else
extern int InputReady(void); // your own
#endif
// ---------------
// 2nd:
// add the following to your main.cpp source file
void * IOInst;
int (__stdcall *input_available) (void *pInst);
char * (__stdcall *get_string ) (void *pInst, char *s, int nmaxlen);
void (__stdcall *put_string ) (void *pInst, const char *s);
int __cdecl PrintF(const char *fmt, ...)
{
int n;
char s[1024];
va_list args;
va_start (args, fmt);
n = vsprintf (s, fmt, args);
va_end (args);
put_string (IOInst, s);
return n;
}
BOOL WINAPI DllMain (HANDLE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
{
return TRUE;
}
__declspec(dllexport) void __stdcall Run (
void *pIOInst,
int (__stdcall *p_input_available) (void *pInst),
char * (__stdcall *p_get_string) (void *pInst, char *s, int nmaxlen),
void (__stdcall *p_put_string) (void *pInst, const char *s)
)
{
IOInst = pIOInst;
input_available = p_input_available;
get_string = p_get_string;
put_string = p_put_string;
main (0, NULL);
}
// ---------------
// 3rd:
// create a .def file that has the following
EXPORTS
Run
// ---------------
// 4th:
// build in MS EVC++
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.