I've fixed ponder mode under Windows.
Msvc 2005 project + src > http://dl.dropbox.com/u/5047625/phalanx ... -12%29.zip
Jim.
Phalanx source code
Moderator: Ras
-
- Posts: 2273
- Joined: Fri Jul 14, 2006 7:56 am
- Location: London, England
- Full name: Jim Ablett
-
- Posts: 121
- Joined: Sat Mar 20, 2010 3:31 am
Re: Phalanx source code
This comes better and better and better.
Thanks jim!
Thanks jim!
-
- Posts: 121
- Joined: Sat Mar 20, 2010 3:31 am
Re: Phalanx source code
Hi again!
Well now ponder works well but TM needs some adjusts.
Phalanx time management is bad..Miguel? Jim?
We are close to the final victory
Well now ponder works well but TM needs some adjusts.
Phalanx time management is bad..Miguel? Jim?
We are close to the final victory

-
- Posts: 2273
- Joined: Fri Jul 14, 2006 7:56 am
- Location: London, England
- Full name: Jim Ablett
Re: Phalanx source code
Here is a modified Phalanx (msvc 2005 project & src) with adjustable personality config file. Just for fun!
http://dl.dropbox.com/u/5047625/phalanx ... -12%29.zip
Jim.

http://dl.dropbox.com/u/5047625/phalanx ... -12%29.zip
Code: Select all
#####################
Phalanx configuration
#####################
(Each option line must have an asterisk at
the front and a number at the end)
*eval_extension_base 60
*eval_null_move_pruning 300
*forward_pruning_on 1 // 1=on 0=off
*recapture_extensions_on 1 // 1=on 0=off
*pee_extensions_on 1 // entering kings+pawns endgame extends 1=on 0=off
*check_extensions_on 1 // 1=on 0=off
*pawnpush_extensions_on 1 // 1=on 0=off
*pawnstrike_extensions_on 0 // 1=on 0=off
*raise_on 0 // Inbalanced material: take positional bonus seriously 1=on 0=off
*quiesce_captures_only 0 // 1=on 0=off
*static_eval_cache_on 1 // 1=on 0=off
*ettc_on 0 // 1=on 0=off
*show_scoring 0
*pawn_piece_value 100
*knight_piece_value 300
*bishop_piece_value 300
*rook_piece_value 500
*queen_piece_value 900
// adjust only one of these (keep the other at zero)
*time_reduce 80 // adjust time per move (reduce)
*time_increase 0 // adjust time per move (increase)
end of config file
Jim.
-
- Posts: 2273
- Joined: Fri Jul 14, 2006 7:56 am
- Location: London, England
- Full name: Jim Ablett
Re: Phalanx source code
Dann Corbit just sent me some fixes for my modified Phalanx ...
Thanks Dann.
Jim.
Download link above has been updated.This is your version that reads personalities with lots of stuff made const-safe and a possible null pointer read changed to
reading an empty string. (Look for bugbug:drc because the called function calls atoi() on the passed pointer)
Thanks Dann.

Jim.
-
- Posts: 121
- Joined: Sat Mar 20, 2010 3:31 am
Re: Phalanx source code
Thanks, Jim!
Sorry, time management are fixed in this las project?
Sorry, time management are fixed in this las project?
-
- Posts: 2273
- Joined: Fri Jul 14, 2006 7:56 am
- Location: London, England
- Full name: Jim Ablett
Re: Phalanx source code
This works ok for me with ponder on.Elorejano wrote:Thanks, Jim!
Sorry, time management are fixed in this las project?
Code: Select all
*time_reduce 80 // adjust time per move (reduce)
Jim.
-
- Posts: 121
- Joined: Sat Mar 20, 2010 3:31 am
Re: Phalanx source code
Thanks and cheers for Dann.
Tell him that we miss him
Tell him that we miss him
-
- Posts: 613
- Joined: Wed Oct 13, 2010 9:44 am
- Location: Australia
Re: Phalanx source code
Jim, do you have patches for the last two round of changes ? (Add ponder feature, and Dann's changes).
The recent dropbox file is formatted totally differently from svn and the files you offered before.
The recent dropbox file is formatted totally differently from svn and the files you offered before.
-
- Posts: 2273
- Joined: Fri Jul 14, 2006 7:56 am
- Location: London, England
- Full name: Jim Ablett
Re: Phalanx source code
stevenaaus wrote:Jim, do you have patches for the last two round of changes ? (Add ponder feature, and Dann's changes).
The recent dropbox file is formatted totally differently from svn and the files you offered before.
Here are differences from svn src that fixes ponder mode under Windows/error messages. (NOT my modified version with config file)
Code: Select all
io.c
=========
/* SIG_INT handler */
void interrupt(int x)
{
int c;
signal(SIGINT,SIG_IGN);
if( Flag.polling )
{
/* ignore lines that begin with '.' */
c=getc(stdin); ungetc(c,stdin);
if( c=='.' ) { fgets(Inp,255,stdin); goto go_on; }
}
if( Flag.ponder < 2)
{
puts("interrupted");
Abort = 1;
goto go_on;
}
while( command() ) {}
go_on:;
if( !Abort && !Flag.polling )
#if defined(_WIN32)
signal(SIGINT, handleSigint);
#else
signal(SIGINT,interrupt);
#endif
}
Code: Select all
io.c // fixes error messages
==========
/* COMMAND: beep, draw, ... ignored */
if(
strncmp( Inp, "beep\n", 5 ) == 0
|| strncmp( Inp, "bogus\n", 6 ) == 0
|| strncmp( Inp, "draw\n", 5 ) == 0
|| strncmp( Inp, "name ", 5 ) == 0
|| strncmp( Inp, "random\n", 7 ) == 0
|| strncmp( Inp, "noise ", 6 ) == 0
|| strncmp( Inp, "accepted ", 9 ) == 0
|| strncmp( Inp, "rejected ", 9 ) == 0
|| strncmp( Inp, "computer\n", 10 ) == 0
|| strncmp( Inp, ".\n", 2 ) == 0
)
{ /* ignore */ Inp[0]='\0'; return 1; }
Code: Select all
search.c
========
if( !Flag.polling )
#if defined(_WIN32)
signal(SIGINT, handleSigint);
#else
signal(SIGINT,interrupt);
#endif
Turns=n;
#if defined (_WIN32) // main fix to get ponder working in Windows
while( (l_iterate() || Flag.analyze )
&& !Abort && Depth < MAXPLY*100 )
#else
while( (Flag.ponder==2 || l_iterate() || Flag.analyze )
&& !Abort && Depth < MAXPLY*100 )
#endif
Code: Select all
evaluate.c
================
lptime = nptime;
if( Flag.post && !Flag.xboard ) verboseline( A_m, A_i, A_n );
isInputAvailable(); // <<<< just this
/*
if( Flag.analyze )
printf("stat01: %d %d %d %d %d\n",0,Nodes,A_d,A_i,A_n);
*/
lnodes = Nodes;
}
}
if( Ply >= MAXPLY-2 )
{ PV[Ply][Ply].from=0; return G[Counter].mtrl-G[Counter].xmtrl; }
Code: Select all
phalanx.h
===========
#if defined(_WIN64)
#define _WIN32 // if compiling 64 bit, need this too
#endif
#if defined(_WIN32)
# include <windows.h>
# include <io.h>
# include <errno.h>
# include <process.h>
#include <signal.h>
#include <stdio.h>
static void handleSigint() {
exit(0);
}
#else
#include <sys/time.h>
#endif
///// dann corbit fixes /////////////
extern const signed char *const Th; /* horizontal axe transf., (H8<->H1) */
extern const signed char *const Tv; /* vertical axe tr., (H8<->A8) */
/* move generation tables */
extern const int N_moves[8],
RB_dirs[8];
extern const int Values[7]; /* piece values */
extern const int *const HS; /* square trans-table */
extern const int HP[]; /* piece trans-table */
///////////////////////////////////////////
static int isInputAvailable() { // moved it here
if(Flag.polling)
{
#if defined(__GNUC__) && !defined(__MINGW32__)
static fd_set readfds;
static struct timeval tv;
int data;
FD_ZERO (&readfds);
FD_SET (fileno(stdin), &readfds);
tv.tv_sec=0;
tv.tv_usec=0;
select(16, &readfds, 0, 0, &tv);
data=FD_ISSET(fileno(stdin), &readfds);
if(data) interrupt(0);
#else
/* Credit here goes to Dr Oliver Brausch for the code from his
* program Olithink. Some rewriting has been done by CMF, but not much
* as I have absolutely no idea whatsoever what this does.
* I think the original code is from Crafty by Prof. Robert Hyatt. */
static int init = 0, pipe;
static HANDLE inh;
DWORD dw;
/* If we're running under XBoard then we can't use _kbhit() as the input commands
* are sent to us directly over the internal pipe */
if (Flag.xboard) {
#if defined(FILE_CNT)
if (stdin->_cnt > 0) return stdin->_cnt;
#endif
if (!init) {
init = 1;
inh = GetStdHandle(STD_INPUT_HANDLE);
pipe = !GetConsoleMode(inh, &dw);
if (!pipe) {
SetConsoleMode(inh, dw & ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT));
FlushConsoleInputBuffer(inh);
}
}
if (pipe) {
if (!PeekNamedPipe(inh, NULL, 0, NULL, &dw, NULL)) return 1;
return dw;
}
else {
GetNumberOfConsoleInputEvents(inh, &dw);
return dw <= 1 ? 0 : dw;
}
}
else return _kbhit();
#endif
}
}
Jim.