Beispiel #1
0
int main() {
  char buf[100];
  // After that we use moggy to analyze it. (With default parameters).
  void* policy = playout_moggy_init(NULL);

  // Put a few random moves and ask mogo to play it out.
  AllMoves all_moves;
  GroupId4 ids;
  const int num_round = 10000;

  Board b;
  timeit
  for (int j = 0; j < num_round; j++) {
    printf("Round = %d/%d\n", j, num_round);
    ClearBoard(&b);
    //for (int i = 0; i < rand() % 100 + 1; ++i) {
    for (int i = 0; i < 0; ++i) {
      FindAllCandidateMoves(&b, b._next_player, 0, &all_moves);
      // Randomly find one move.
      int idx = rand() % all_moves.num_moves;
      if (TryPlay2(&b, all_moves.moves[idx], &ids)) {
        Play(&b, &ids);
      }
    }

    ShowBoard(&b, SHOW_LAST_MOVE);
    play_random_game(policy, NULL, NULL, &b, -1, FALSE);
    ShowBoard(&b, SHOW_LAST_MOVE);
  }
  endtime

  playout_moggy_destroy(policy);
  return 0;
}
Beispiel #2
0
int Connect4Player::Chance(int player)
{
	system("cls");
	ShowBoard();
	int row=PlayerMove(Turn(),player);
	while(!(row>=0))
	{
			system("cls");
			cout<<" Wrong move try again\n ";
			system("Pause");
			system("cls");
			ShowBoard();
			row=PlayerMove(Turn(),player);
	}
	return row;		
}
void ICP::DcDS(void) const
{
  // Display status

  NoParameters();
  ShowBoard(); ShowMoves(); ShowLimits(); ShowOptions(); ShowFEN(); ShowPosHash();
}
Beispiel #4
0
void test_do_move()
{
	printf("chess-test: testing do move (a4)...\n");
	int success = DoMoveChessoid("a4");
	ShowBoard();
	printf("chess-test: result was: %d\n", success);
}
Beispiel #5
0
void LoadEPD (char *p)
/**************************************************************************
 *   
 *  This routine reads in the next or the Nth position in the file.
 *
 **************************************************************************/
{
   char file[MAXSTR];
   int N = 1;

   sscanf (p, "%127s %d ", file, &N);
   if (strcmp (file, "next") == 0)
   {
      ReadEPDFile (file, 0);
   }
   else
   { 
      ReadEPDFile (file, 1);
      while (--N)
      {
         if (ReadEPDFile (file, 2) == false)
         {
	    printf ("File position exceeded\n");
	    return; 
         }
      }
      ReadEPDFile (file, 0);
   }
   ShowBoard ();
   NewPosition ();
}
Beispiel #6
0
void PGNReadFromFile (const char *file)
/****************************************************************************
 *
 *  To read a game from a PGN file.
 *
 ****************************************************************************/
{
   FILE *fp;

   fp = fopen (file, "r");
   if (fp == NULL)
   {
      printf ("Cannot open file %s\n", file);
      return;
   }
   yyin = fp;
   
   InitVars ();

   data_dest = DEST_GAME;
   (void) yylex();

   fclose (fp);
   ShowBoard ();
   TTClear ();
}
void CConfigWizard::OnLbnSelchangeListbox()
{
	int nSel = m_lbStep.GetCurSel();
	if (nSel == -1)
		return;

	ShowBoard(nSel);
}
Beispiel #8
0
void PGNReadFromFile (const char *file)
/****************************************************************************
 *
 *  To read a game from a PGN file.
 *
 ****************************************************************************/
{
   FILE *fp;
   char s[100], c, wmv[8], bmv[8];
   int moveno;
   leaf *p;

   fp = fopen (file, "r");
   if (fp == NULL)
   {
      printf ("Cannot open file %s\n", file);
      return;
   }

   /* Skip all the tags */
   do
   {
      if ((c = fgetc (fp)) == '[')
         fgets (s, 100, fp);
   } while (c == '[');
   ungetc (c, fp);

   InitVars ();
   while (!feof (fp))
   {
      c = fgetc(fp);
      if (c == '*') break;
      ungetc (c, fp);
      fscanf (fp, "%d. %7s %7s ", &moveno, wmv, bmv);
      p = ValidateMove (wmv);
      if (!p)
      {
	 printf ("Illegal move %d. %s\n", moveno, wmv);
	 break;
      }
      MakeMove (white, &p->move);
      strcpy (Game[GameCnt].SANmv, wmv);
      if (*bmv == '*' ) break;
      p = ValidateMove (bmv);
      if (!p)
      {
	 printf ("Illegal move %d. ... %s\n", moveno, bmv);
	 break;
      }
      MakeMove (black, &p->move);
      strcpy (Game[GameCnt].SANmv, bmv);
   }
   printf ("%d\n", GameCnt);
   fclose (fp);
   ShowBoard ();
   TTClear ();
   return;
}
Beispiel #9
0
void Connect4Player::IsWin(tBoardType mat,int row,int col,char name[30])
{
	if(Check_LtoR(mat,row,col)||Check_RD(mat,row,col)||Check_LD(mat,row,col)||Check_UtoD(mat,row,col))
		{
				
			system("cls");
			ShowBoard();
			cout<<"\nConguratulations "<<name<<" You Won !!!\n";
			exit(0);
		}	
}
Beispiel #10
0
int main()
{
	printf("chess-test: starting chess engine test...\n");
	ShowBoard();
	test_init_engine();
	test_show_board();
	test_board_as_string();
	test_validate_move();
	test_input_cmd_chessoid();
	test_do_move();
	printf("chess-test: chess engine test complete.\n");
	return 0;
}
Beispiel #11
0
void cmd_last(void)
{
  if (!pgnloaded)
    return;

  while (GameCnt+1 <= pgncnt) {
    ChangeColor( true );
    SetAutoGo( true );
    MakeMove (board.side, &Game[GameCnt+1].move);
  }

  printf("%d. ",GameCnt/2+1);
  printf("%s\n", Game[GameCnt].SANmv);
  ShowBoard ();
}
BOOL CConfigWizard::OnInitDialog()
{
	CDialog::OnInitDialog();
	
	CConsoleDlg *pMainWnd = static_cast<CConsoleDlg*>(AfxGetMainWnd());


	CString strPath = I8DESK_OEM->GetString(_T("config"), _T(""));
	if( strPath.IsEmpty() || strPath == _T("") )
		m_bnStepDesc.SetImage(IDB_LOGIN1);//->GetIcon(TRUE), NULL);
	else
		m_bnStepDesc.SetImage(strPath);

	//m_bnStepDesc.SetIconImage(pMainWnd->GetIcon(TRUE), NULL);
	COLORREF clr = RGB(255, 255, 255);
	m_bnStepDesc.SetTextStyle(_T("宋体"), 16, clr, clr, clr, clr, 
		CButtonEx::BTEXT_RIGHT, TRUE);
	
//	clr = RGB(241, 247, 250);
//	m_bnStepDesc.SetImage3(clr, clr, clr, clr);

	m_bnBoardPlace.SetImage3(clr, clr, clr, clr);

	RECT rc;
	m_bnBoardPlace.GetWindowRect(&rc);
	m_bnBoardPlace.ScreenToClient(&rc);
	rc.top += 1, rc.left += 1, rc.bottom -= 1, rc.right -= 1;

	AddBoard<CWZWelcomeBoard>(&rc, _T("欢迎使用向导"));
	AddBoard<CWZAreaMgrBoard>(&rc, _T("划分终端区域"));
	AddBoard<CWZClassMgrBoard>(&rc, _T("划分游戏类别"));
	AddBoard<CWZVDiskMgrBoard>(&rc, _T("设置虚拟磁盘"));
	AddBoard<CWZDownloadBoard>(&rc, _T("设置三层下载"));
	AddBoard<CWZMenuBoard>(&rc, _T("设置菜单显示"));
	AddBoard<CWZAddGameBoard>(&rc, _T("搜索添加游戏"));
	AddBoard<CWZUpdateBoard>(&rc, _T("设置内网更新"));
	AddBoard<CWZAccountBoard>(&rc, _T("设置安全密码"));
	AddBoard<CWZBootTaskBoard>(&rc, _T("设置开机任务"));
	AddBoard<CWZSafeCenterBoard>(&rc, _T("设置安全中心"));
	AddBoard<CWZServerBoard>(&rc, _T("部署多服务器"));
	AddBoard<CWZSyncTaskBoard>(&rc, _T("部署同步任务"));

	ShowBoard(0);

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
Beispiel #13
0
int Connect4Player::Turn()
{
	char check;
	printf("\nChoose your column %s : ",mPlayerName);
	check=getche();
	while(!isdigit(check))
	{
		system("cls");
		ShowBoard();
		printf("\nChoose your column %s : ",mPlayerName);
		check=getche();
	}
		getch();
		mPlace=check-48;
		cin.sync();
		return mPlace;
}
Beispiel #14
0
void cmd_next(void)
{
  if (!pgnloaded)
    return;

  if ((GameCnt+1) <= pgncnt) {
    ChangeColor( true );
    SetAutoGo( true );
    MakeMove (board.side, &Game[GameCnt+1].move);
  } else {
    printf(_("No more moves. Game reached the end.\n"));
    return;
  }

  printf("%d. ",GameCnt/2+1);
  printf("%s\n", Game[GameCnt].SANmv);
  ShowBoard ();
}
main()
{
	int Row, Col;
	Board = new BOARD( 6, 9 );

	BYTE ShipsNotFound = Board->GetShipNumber();
	while( ShipsNotFound ){
		ShowBoard();
		cout << "\nZeile : ";
		cin >> Row;
		cout << "\nSpalte : ";
		cin >> Col;
		if( Board->GetDiscovered( Row, Col ) != -1) continue;
		if( Board->Scan( Row, Col ) == Board->GetShipNumber() + 10)
			ShipsNotFound--;
	}
	cout << "You needed " << Board->MovesNeeded() << " moves to win!\n";
}
Beispiel #16
0
void TestCaptureList (void)
/****************************************************************************
 *  
 *  This routine reads in a *.epd file (EPD notation) and prints the capture
 *  moves for that position.  
 *
 ****************************************************************************/
{
   while (ReadEPDFile ("TEST/GMG1.epd", 0))
   {
      ShowBoard (); 
      GenCnt = 0;
      TreePtr[2] = TreePtr[1];
      GenCaptures (1);
      FilterIllegalMoves (1);
      ShowMoveList (1); 
      printf ("No. of moves generated = %lu\n\n", GenCnt);
   }
}
Beispiel #17
0
void cmd_previous(void)
{
  if (!pgnloaded)
    return;

  if (GameCnt >= 0) {
    ChangeColor( true );
    SetAutoGo( true );
    UnmakeMove (board.side, &Game[GameCnt].move);
  }
  else {
    printf(_("Initial position reached. There are no earlier moves.\n"));
    return;
  }

  printf("%d. ",GameCnt/2+1);
  printf("%s\n", Game[GameCnt].SANmv);
  ShowBoard ();
}
Beispiel #18
0
void Solve (char *file)
/*****************************************************************************
 *
 *
 *
 *****************************************************************************/
{
   int total, correct, found;
   long TotalNodes;
   char *p;

   total = correct = 0;
   TotalNodes = 0;
   SET (flags, SOLVE); 
   while (ReadEPDFile (file, 0))
   {
      NewPosition ();
      total++;
      ShowBoard (); 
      Iterate ();
      TotalNodes += NodeCnt + QuiesCnt;
      p = solution;
      found = false;
      while (*p != '\0')
      {
         if (!strncmp (p, SANmv, strlen(SANmv)))
         {
	    correct++;
	    found = true;
	    break;
         }
         while (*p != ' ' && *p != '\0') p++;
	 while (*p == ' ' && *p != '\0') p++;
      }
      printf ("%s : ", id);
      printf (found ? "Correct:  " : "Incorrect:  ");
      printf ("%s %s\n", SANmv, solution);
      printf ("Correct=%d Total=%d\n", correct, total);
   }
   printf ("\nTotal nodes = %ld\n", TotalNodes);
   CLEAR (flags, SOLVE);
}
Beispiel #19
0
void cmd_first(void)
{
  if (!pgnloaded)
    return;

  while (GameCnt >= 0) {
    if (GameCnt >= 0) {
      CLEAR (flags, ENDED);
      CLEAR (flags, TIMEOUT);
      ChangeColor( true );
      SetAutoGo( true );
      UnmakeMove (board.side, &Game[GameCnt].move);
      if (GameCnt >= 0) {
        UnmakeMove (board.side, &Game[GameCnt].move);
      }
    }
  }

  ShowBoard ();
}
void CConfigWizard::OnBnClickedOk()
{
	if (!GetDbMgr()->IsConnected())
	{
		AfxMessageBox("与服务器连接中断,不能完成配置!");
		return;
	}

	for (size_t i = 0; i < m_wizards.size(); i++) 
	{
		LRESULT ok = m_wizards[i]->SendMessage(i8desk::g_nOptApplyMsg, 0, 0);
		if (!ok)
		{
			ShowBoard(i);
			return;
		}
	}

	OnOK();
}
Beispiel #21
0
void TestEval (void)
/**************************************************************************
 *
 *  To test the evaluation routines,  read from the BK.epd test file.
 *  Print out the score.  This can be improved by being more verbose
 *  and printing out salient features of the board, e.g. King safety,
 *  double bishops, rook on seventh rank, weak pawns, doubled pawns,
 *  bad bishops, passwd pawns, etc etc.
 *
 ***************************************************************************/
{
   int score;

   SET (flags, TESTT);
   while (ReadEPDFile ("../test/wac.epd", 0))
   {
      ShowBoard ();
      score = Evaluate (-INFINITY, INFINITY);
      printf (board.side == white ? "W : " : "B : ");
      printf ("score = %d\n\n", score);
   }
   CLEAR (flags, TESTT);
}
Beispiel #22
0
void BookPGNReadFromFile (const char *file)
/****************************************************************************
 *
 *  To read a game from a PGN file and store out the hash entries to book.
 *
 ****************************************************************************/
{
   FILE *fp;
   char s[100], wmv[8], bmv[8];
   int c;
   unsigned int i;
   char header[2000];
   int moveno, result, ngames = 0;
   leaf *p;
   time_t t1, t2;
   double et;
   int examinecolor, playerfound[2];

/* Only players in the table below are permitted into the opening book 
   from the PGN files. Please expand the table as needed. Generally,
   I would recommend only acknowledged GM's and IM's and oneself, but
   because of the self-changing nature of the book, anything inferior
   will eventually be eliminated through automatic play as long as
   you feed the games the program plays back to itself with "book add pgnfile"
*/
/* XXX: Is it really a good idea to have a list like this hardcoded? */

const char *const player[] = {
  "Alekhine",
  "Adams",
  "Anand",
  "Anderssen",
  "Andersson",
  "Aronin",
  "Averbakh",
  "Balashov",
  "Beliavsky",
  "Benko",
  "Bernstein",
  "Bird",
  "Bogoljubow",
  "Bolbochan",
  "Boleslavsky",
  "Byrne",
  "Botvinnik",
  "Bronstein",
  "Browne",
  "Capablanca",
  "Chigorin",
  "Christiansen",
  "De Firmian",
  "Deep Blue",
  "Deep Thought",
  "Donner",
  "Dreev",
  "Duras",
  "Euwe",
  "Evans",
  "Filip",
  "Fine",
  "Fischer",
  "Flohr",
  "Furman",
  "Gelfand",
  "Geller",
  "Gereben",
  "Glek",
  "Gligoric",
  "GNU",
  "Golombek",
  "Gruenfeld",
  "Guimard",
  "Hodgson",
  "Ivanchuk",
  "Ivkov",
  "Janowsky",
  "Kamsky",
  "Kan",
  "Karpov",
  "Kasparov",
  "Keres",
  "Korchnoi",
  "Kortschnoj",
  "Kotov",
  "Kramnik",
  "Kupreich",
  "Lasker",
  "Lautier",
  "Letelier",
  "Lilienthal",
  "Ljubojevic",
  "Marshall",
  "Maroczy",
  "Mieses",
  "Miles",
  "Morphy",
  "Mueller",     /* Every other German has this name... */
  "Nimzowitsch",
  "Nunn",
  "Opocensky",
  "Pachman",
  "Petrosian",
  "Piket",
  "Pilnik",
  "Pirc",
  "Polgar",
  "Portisch",
  "Psakhis",
  "Ragozin",
  "Reshevsky",
  "Reti",
  "Romanish",
  "Rubinstein",
  "Saemisch",
  "Seirawan",
  "Shirov",
  "Short",
  "Silman",
  "Smyslov",
  "Sokolsky",
  "Spassky",
  "Sveshnikov",
  "Stahlberg",
  "Steinitz",
  "Tal",
  "Tarjan",
  "Tartakower",
  "Timman",
  "Topalov",
  "Torre",
  "Vidmar"

  };

   et = 0.0;
   t1 = time(NULL);
   result = -1;
   fp = fopen (file, "r");
   if (fp == NULL)
   {
     fprintf(stderr, "Cannot open file %s: %s\n", 
	     file, strerror(errno));
     return;
   }

   /* Maybe add some more clever error handling later */
   if (BookBuilderOpen() != BOOK_SUCCESS)
     return;
   newpos = existpos = 0;


 nextgame:

   header[0] = 0;
   InitVars ();
   NewPosition ();
   CLEAR (flags, MANUAL);
   CLEAR (flags, THINK);
   myrating = opprating = 0;

   playerfound[black] = playerfound[white] = 0;

   /* Skip all the tags */
   /*
    * XXX: This has two problems: 1) Leading whitespace leads to
    * undefined stuff in s, and completely confuses the program.
    * 2) If there is a game between two players in the list, only
    * the moves of the white player will be added.
    */

   /* Skip whitespace */
   while ((c=fgetc(fp)) != EOF) {
     if (c != ' ' && c != '\t' && c != '\n') {
       ungetc(c, fp);
       break;
     }
   }
   
   while ((c=fgetc(fp)) == '[') {
     ungetc(c, fp);
     fgets(s, 100, fp);
     strcat(header,s);
     if (strncmp(s+1, "White ",6) == 0) {
       examinecolor = white;
       ngames++;
     } else if (strncmp(s+1, "Black ",6) == 0) {
       examinecolor = black;
     } else if (strncmp(s+1, "Result", 6) == 0) {
       if (strncmp(s+7," \"1-0",5) == 0) {
	 result = R_WHITE_WINS;
       } else if (strncmp(s+7," \"0-1",5) == 0) {
	 result = R_BLACK_WINS;
       } else if (strncmp(s+7," \"1/2-1/2",9) == 0) {
	 result = R_DRAW;
       } else {
	 result = R_NORESULT;
       }
       continue;
     } else continue;
     /*
      * We get only here if White or Black matched, it is ugly but it 
      * works. Attention: If at some point we want to put this array
      * of authorized players in some external file, we have to keep
      * track of the size of that array in some other way.
      */
     for (i = 0; i < (sizeof(player) / sizeof(*player)); i++) {
       if (strstr(s+7, player[i]) != NULL) {
	 playerfound[examinecolor] = 1;
       }
     }
   }
   ungetc(c, fp);
   while (1) {
     if (fscanf(fp, "%d. %7s ", &moveno, wmv) < 2) break;

     if (wmv[0] == '1' || wmv[0] == '[' || wmv[0] == '*'
	 || strcmp(wmv, "0-1") == 0) break;
     
     p = ValidateMove (wmv);
     if (!p) {
       puts(header);
       ShowBoard();
       printf ("Illegal move %d. %s\n", moveno, wmv);
       break;
     }
     MakeMove (white, &p->move);
     if (playerfound[white]) {
       if (BookBuilder (result, white) != BOOK_SUCCESS) break;
     }
     strcpy (Game[GameCnt].SANmv, wmv);
     
     if (fscanf(fp, "%7s ", bmv) < 1) break;
     if (bmv[0] == '1' || bmv[0] == '[' || bmv[0] == '*'
	 || strcmp(bmv, "0-1")  == 0) break;

     p = ValidateMove (bmv);
     if (!p) {
       puts (header);
       ShowBoard();
       printf ("Illegal move %d. ... %s\n", moveno, bmv);
       break;
     }
     MakeMove (black, &p->move);
     if (playerfound[black] ) {
       if (BookBuilder (result, black) != BOOK_SUCCESS) break;
     }
     strcpy (Game[GameCnt].SANmv, bmv);
   }

   /* Read to end of game but don't parse */
   while (!feof(fp)) {
     fgets(s,100,fp);
     if (s[0] == '\n') break;
   }
   /* printf ("%d(%d)\n", GameCnt,BOOKDEPTH); */
   if (!feof(fp)) {
     if (ngames % 10 == 0) printf("%d\r",ngames);
     fflush(stdout);
     goto nextgame;
   }

   fclose (fp);
   if (BookBuilderClose() != BOOK_SUCCESS) {
     perror("Error writing opening book");
   }

   /* Reset the board otherwise we leave the last position in the book
      on the board. */
   header[0] = 0;
   InitVars ();
   NewPosition ();
   CLEAR (flags, MANUAL);
   CLEAR (flags, THINK);
   myrating = opprating = 0;

   t2 = time(NULL);
   et += difftime(t2, t1);
   putchar('\n');

   /* Handle divide-by-zero problem */
   if (et < 0.5) { et = 1.0; };

   printf("Time = %.0f seconds\n", et);
   printf("Games compiled: %d\n",ngames);
   printf("Games per second: %f\n",ngames/et);
   printf("Positions scanned: %d\n",newpos+existpos);
   printf("Positions per second: %f\n",(newpos+existpos)/et);
   printf("New & unique added: %d positions\n",newpos);
   printf("Duplicates not added: %d positions\n",existpos);
}
Beispiel #23
0
/*******************************************************************
 *	Dispatch command according to $type, $tag in skin tags
 *
 *******************************************************************/
void 
DoTagCommand(char *type, char *tag)
{
	if (!strcasecmp(type, "Post"))
	{
		ShowPost(tag, &c_board, post_file);
	}
	else if (!strcasecmp(type, "PostList"))
	{
		ShowPostList(tag, &c_board, post_file);
	}
	else if (!strcasecmp(type, "User"))
	{
		ShowUser(tag, &curuser);
	}
	else if (!strcasecmp(type, "UserList"))
	{
		ShowUserList(tag, post_file);
	}
	else if (!strcasecmp(type, "Mail"))
	{
		ShowMail(tag);
	}
	else if (!strcasecmp(type, "Board"))
	{
		ShowBoard(tag, &c_board, post_file);
	}
	else if (!strcasecmp(type, "BoardList"))
	{
		ShowBoardList(tag, post_file);
	}
	else if (!strcasecmp(type, "SubDir"))
	{
		fprintf(fp_out, "/%s", BBS_SUBDIR);
	}
	else if (!strcasecmp(type, "Message"))
	{
		fprintf(fp_out, "%s", WEBBBS_ERROR_MESSAGE);
	}
	else if (!strcasecmp(type, "Server"))
	{
		ShowServerInfo(tag, server, request_rec, file_shm, html_shm);
	}
	else if (!strcasecmp(type, "Proxy"))
	{
		if (strlen(request_rec->via))
		{
			char proxy[STRLEN * 2];

			xstrncpy(proxy, request_rec->via + 4, sizeof(proxy));
			strtok(proxy, ",(");
			fprintf(fp_out, "%s", proxy);
		}
	}
	else if (!strcasecmp(type, "Skin"))
	{
		if (PSCorrect == Correct && (c_board.brdtype & BRD_WEBSKIN) 
			&& (!strcmp(username, c_board.owner) || HAS_PERM(PERM_SYSOP)))
		{
			fprintf(fp_out, "<a href=\"/%sboards/%s/%s\">[BM]修改看板介面</a>",
			     BBS_SUBDIR, c_board.filename, HTML_SkinModify);
		}
	}
	else if (!strcasecmp(type, "Announce"))
	{
		ShowArticle(WELCOME, FALSE, TRUE);
	}
	else if (!strcasecmp(type, "NewGuide"))
	{
		ShowArticle(NEWGUIDE, FALSE, TRUE);
	}

}
void ICP::DcDB(void) const
{
  // Display board

  NoParameters(); ShowBoard();
}
Beispiel #25
0
void test_show_board()
{
	printf("chess-test: testing show chess board...\n");
	ShowBoard();
	printf("chess-test: test show chess board complete.\n");
}
void CConfigWizard::OnBnClickedPrevWizard()
{
	ShowBoard(m_iCurrentWizard - 1);
}
void CConfigWizard::OnBnClickedNextWizard()
{
	ShowBoard(m_iCurrentWizard + 1);
}
Beispiel #28
0
static void GameListSelectRow(GtkCList *pcl, gint y, gint x, GdkEventButton *pev, gpointer p)
{
#if USE_BOARD3D
    BoardData *bd = BOARD( pwBoard )->board_data;
#endif
    gamelistrow *pglr;
    moverecord *pmr, *pmrPrev = NULL;
    listOLD *pl;

    if( x < 1 || x > 2 )
    	return;

    pglr = gtk_clist_get_row_data( pcl, y );
    if (!pglr)
    	pmr = NULL;
    else
    	pmr = pglr->apmr[(pglr->fCombined) ? 0 : x - 1];

    /* Get previous move record */
    if (!pglr->fCombined && x == 2)
    	x = 1;
    else
    {
    	y--;
    	x = 2;
    }
    pglr = gtk_clist_get_row_data( pcl, y );
    if (!pglr)
    	pmrPrev = NULL;
    else
    	pmrPrev = pglr->apmr[(pglr->fCombined) ? 0 : x - 1];

    if (!pmr && !pmrPrev)
    	return;

    for( pl = plGame->plPrev; pl != plGame; pl = pl->plPrev ) {
    	g_assert( pl->p );
    	if( pl == plGame->plPrev && pl->p == pmr && pmr->mt == MOVE_SETDICE )
    	break;

    	if( pl->p == pmrPrev && pmr != pmrPrev ) {
    	/* pmr = pmrPrev; */
    	break;
    	} else if( pl->plNext->p == pmr ) {
	    /* pmr = pl->p; */
	    break;
	}
    }

    if( pl == plGame )
    	/* couldn't find the moverecord they selected */
    	return;
    
    plLastMove = pl;

    CalculateBoard();

    if ( pmr && (pmr->mt == MOVE_NORMAL || pmr->mt == MOVE_SETDICE) ) {
       /* roll dice */
       ms.gs = GAME_PLAYING;
       ms.anDice[ 0 ] = pmr->anDice[ 0 ];
       ms.anDice[ 1 ] = pmr->anDice[ 1 ];
   }
#if USE_BOARD3D
	if (display_is_3d(bd->rd))
	{	/* Make sure dice are shown (and not rolled) */
		bd->diceShown = DICE_ON_BOARD;
		bd->diceRoll[0] = !ms.anDice[0];
	}
#endif

    UpdateSetting( &ms.nCube );
    UpdateSetting( &ms.fCubeOwner );
    UpdateSetting( &ms.fTurn );
    UpdateSetting( &ms.gs );
    
    SetMoveRecord( pl->p );
    
    ShowBoard();
}