OpenCores
URL https://opencores.org/ocsvn/connect-6/connect-6/trunk

Subversion Repositories connect-6

[/] [connect-6/] [trunk/] [BUILD_SCC/] [synth_src/] [shared.h] - Diff between revs 4 and 7

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 4 Rev 7
Line 1... Line 1...
 
#ifndef SHARED_H
 
#define SHARED_H
/*
/*
 
 
connectk -- a program to play the connect-k family of games
connectk -- a program to play the connect-k family of games
Copyright (C) 2007 Michael Levin
Copyright (C) 2007 Michael Levin
 
 
Line 21... Line 22...
*/
*/
/* Some definitions in case glib is not included */
/* Some definitions in case glib is not included */
//#ifndef TRUE
//#ifndef TRUE
#define TRUE 1
#define TRUE 1
#define FALSE 0
#define FALSE 0
#define NULL ((void*)0)
//#define NULL ((void*)0)
//#endif
//#endif
//#ifndef __G_TYPES_H__
//#ifndef __G_TYPES_H__
typedef unsigned int gboolean;
typedef unsigned int gboolean;
#pragma bitsize gboolean 1
#pragma bitsize gboolean 1
typedef int gsize;
typedef int gsize;
//#endif
//#endif
 
#include "pico.h"
 
 
 
 
/*
/*
 *      Options
 *      Options
 */
 */
Line 302... Line 304...
        AIMove data[361];
        AIMove data[361];
        /* Array of AIMove structures */
        /* Array of AIMove structures */
} AIMoves;
} AIMoves;
/* An array type for holding move lists */
/* An array type for holding move lists */
 
 
 
 
 
typedef struct {
 
        int threat[2];
 
        PIECE turn[2];
 
} Line;
 
typedef struct{
 
        int data[MAX_CONNECT_K + 1][2];
 
}threat_count_array;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
AllocChain *aimoves_alloc(AllocChain *data);
AllocChain *aimoves_alloc(AllocChain *data);
#define aimoves_new() ((AIMoves*)achain_new(&aimoves_root, aimoves_alloc))
#define aimoves_new() ((AIMoves*)achain_new(&aimoves_root, aimoves_alloc))
//#define aimoves_free(m) achain_free((AllocChain*)(m))
//#define aimoves_free(m) achain_free((AllocChain*)(m))
static inline void aimoves_free(AIMoves *m) {
static inline void aimoves_free(AIMoves *m) {
        m->len=0;
        m->len=0;
Line 323... Line 341...
void aimoves_append(AIMoves *moves, const AIMove *aim);
void aimoves_append(AIMoves *moves, const AIMove *aim);
#define aimoves_set aimoves_append
#define aimoves_set aimoves_append
///////////* Add an AIMove to an AIMoves array; existing moves weights will be
///////////* Add an AIMove to an AIMoves array; existing moves weights will be
//////////   overwritten */
//////////   overwritten */
//////////
//////////
int aimoves_choose(AIMoves *moves, AIMove *move);
int aimoves_choose(AIMoves *moves, AIMove *move, unsigned int *index);
/* Will choose one of the best moves from a GArray of AIMove structures at
/* Will choose one of the best moves from a GArray of AIMove structures at
   random. Returns non-zero if a move was chosen or zero if a move could not
   random. Returns non-zero if a move was chosen or zero if a move could not
   be chosen for some reason. */
   be chosen for some reason. */
//////////
//////////
int aimoves_compare(const void *a, const void *b);
int aimoves_compare(const void *a, const void *b);
Line 398... Line 416...
//////////   function */
//////////   function */
//////////
//////////
/*AIMoves **/ void enum_adjacent(Board *b, int dist,AIMoves *moves,unsigned int current_random);
/*AIMoves **/ void enum_adjacent(Board *b, int dist,AIMoves *moves,unsigned int current_random);
/* Enumerate empty tiles at most dist away from some other piece on the board */
/* Enumerate empty tiles at most dist away from some other piece on the board */
 
 
 
void streamsort(AIMoves *moves,unsigned int *index);
/*AIMoves **/void ai_marks(Board *b, PIECE min,AIMoves *moves);
/*AIMoves **/void ai_marks(Board *b, PIECE min,AIMoves *moves);
/* Fills a moves list with tiles marked at least PIECE_THREAT(min) */
/* Fills a moves list with tiles marked at least PIECE_THREAT(min) */
 
 
/*
/*
 *      AI
 *      AI
Line 446... Line 465...
 
 
 
 
void my_srandom(int seed,unsigned int *current_random);
void my_srandom(int seed,unsigned int *current_random);
int my_irand(int imax,unsigned int current_random);
int my_irand(int imax,unsigned int current_random);
//void backup_move(Board *board, AIMoves *moves,AIMove *move);
//void backup_move(Board *board, AIMoves *moves,AIMove *move);
AIWEIGHT threat_line(int x, int y, int dx, int dy,Board *b,Board *bwrite,AIMoves *moves,int k);
//AIWEIGHT threat_line(int x, int y, int dx, int dy,Board *b,Board *bwrite,int k,int loop_bound);
int threat_window(int x, int y, int dx, int dy,
//int threat_window(int x, int y, int dx, int dy,
                         PIECE *ptype, int *pdouble,Board *b);
//                         PIECE *ptype, int *pdouble,Board *b);
int connect6ai_synth(int firstmove,char movein[8], char colour, char moveout[8]);
int connect6ai_synth(int firstmove,char movein[8], char colour, char moveout[8]);
 
//extern "C" AIMove pico_stream_input_queue();
 
//extern "C" void pico_stream_output_queue(AIMove);
 
//extern "C" AIMove pico_ips_fifo_read_queue();
 
//extern "C" void pico_ips_fifo_write_queue(AIMove);
 
//extern int id;
 
//extern int ready; 
 
#endif
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.