Files
Ustagammon/engine/gnubg/positionid.h
T
Pierre MARTINandClaude Opus 5.5 792f6395bf Copie figée du cœur de GNU Backgammon (commit 14b6798)
Fichiers repris sans modification dans engine/gnubg/, poids et table
d'équité Kazaross-XG2 dans engine/data/, provenance détaillée dans
engine/gnubg/PROVENANCE.md. Le lint ne vérifie plus les espaces de ces
copies, pour qu'elles restent identiques à l'original.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 13:56:23 +01:00

65 lines
2.6 KiB
C

/*
* Copyright (C) 1998-2002 Gary Wong <gtw@gnu.org>
* Copyright (C) 2000-2014 the AUTHORS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef POSITIONID_H
#define POSITIONID_H
#include "gnubg-types.h"
#define L_POSITIONID 14
extern void PositionKey(const TanBoard anBoard, positionkey * pkey);
extern char *PositionID(const TanBoard anBoard);
extern char *PositionIDFromKey(const positionkey * pkey);
extern int PositionFromXG(TanBoard anBoard, const char * pos);
extern
unsigned int PositionBearoff(const unsigned int anBoard[], unsigned int nPoints, unsigned int nChequers);
extern void PositionFromKey(TanBoard anBoard, const positionkey * pkey);
extern void PositionFromKeySwapped(TanBoard anBoard, const positionkey * pkey);
/* Return 1 for success, 0 for invalid id */
extern int PositionFromID(TanBoard anBoard, const char *pchEnc);
extern void PositionFromBearoff(unsigned int anBoard[], unsigned int usID,
unsigned int nPoints, unsigned int nChequers);
extern unsigned short PositionIndex(unsigned int g, const unsigned int anBoard[6]);
#define EqualKeys(k1, k2) ((k1).data[0]==(k2).data[0]&&(k1).data[1]==(k2).data[1]&&(k1).data[2]==(k2).data[2]&&(k1).data[3]==(k2).data[3]&&(k1).data[4]==(k2).data[4]&&(k1).data[5]==(k2).data[5]&&(k1).data[6]==(k2).data[6])
#define CopyKey(ks, kd) (kd).data[0]=(ks).data[0],(kd).data[1]=(ks).data[1],(kd).data[2]=(ks).data[2],(kd).data[3]=(ks).data[3],(kd).data[4]=(ks).data[4],(kd).data[5]=(ks).data[5],(kd).data[6]=(ks).data[6]
extern int EqualBoards(const TanBoard anBoard0, const TanBoard anBoard1);
/* Return 1 for valid position, 0 for not */
extern int CheckPosition(const TanBoard anBoard);
extern void ClosestLegalPosition(TanBoard anBoard);
extern unsigned int Combination(unsigned int n, unsigned int r);
extern unsigned char Base64(unsigned char ch);
extern void oldPositionFromKey(TanBoard anBoard, const oldpositionkey * pkey);
extern void oldPositionKey(const TanBoard anBoard, oldpositionkey * pkey);
#endif