/* '='='=' '@' '='='='='='='='='=' '@' '='='='='='='='='=' '@' '='='='| */
/* ='='=' '@'@' '='='='='='='='=' '@'@' '='='='='='='='=' '@'@' '='='=| */
/* '='=' '@':'@' '='='='='='='=' '@':'@' '='='='='='='=' '@':'@' '='='| */
/* ='=' '@':':'@' '='='='='='=' '@':':'@' '='='='='='=' '@':':'@' '='=| */
/* '=' '@':':':'@' '='='='='=' '@':':':'@' '='='='='=' '@':':':'@' '='| */
/* =' '@':':':':'@' '='='='=' '@':':':':'@' '='='='=' '@':':':':'@' '=| */
/* ' '@':'                                                       '@' '| */
/*  '@'         3rd Year Project - ROY SCHESTOWITZ - 2002          @' | */
/* '@                                                               @'| */
/* @':':':':':':':':'@' ' '@':':':':':':':':'@' ' '@':':':':':':':':'@| */
/* ':':':':':':':':':'@' '@':':':':':':':':':'@' '@':':':':':':':':':'| */
/* :':':':':':':':':':'@'@':':':':':':':':':':'@'@':':':':':':':':':':| */
/* ':':':': : :':':':':'@':':':':': : :':':':':'@':':':':': : :':':':'| */
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/*              Name:           hashing.h                               */
/*              Version:        0.6.6                                   */
/*              Date:           12/2/2003                               */
/*                                                                      */
/*              Datastructures for the hashtable procedures             */
/*                                                                      */
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/*         Original implementation courtesy of Graham Gough             */

/************************************************************************/
/**********************  INCLUDES  **************************************/
/************************************************************************/


/************************************************************************/
/**********************  DEFINES  ***************************************/
/************************************************************************/

#ifndef TABLE_HASH_H
#define TABLE_HASH_H

/************************************************************************/
/**********************  DATA STRUCTURES  *******************************/
/************************************************************************/

typedef int Boolean;

/* The type for keys */
typedef char *Key_Type;

/* Type for size of hash table */
typedef unsigned int Table_size;

/* Type for index into hash table */
typedef unsigned int Index;

/* Type for state of hash table entry */
enum kind_of_entry
{ legitimate, empty, deleted };

/* Type for hash table entry */
struct hash_entry
{
  Key_Type element;
  int x;			/* Horizontal coordinate on board */
  int y;			/* Vertical coordinate on board   */
  enum kind_of_entry state;
};

typedef struct hash_entry cell;

/* The underlying hash table stucture */
struct hash_tbl
{
  Table_size table_size;
  Table_size num_entries;
  cell *the_cells;		/* an array of hash_entry cells,
				 * allocated during initialisation */
};

/* The hash table */
/* - a pointer to the hash table stucture */
typedef struct hash_tbl *Table;

/************************************************************************/
/**********************  PROTOTYPES  ************************************/
/************************************************************************/

Table initialize_table ( Table_size );

Table insert ( Key_Type, Table, int, int );

Boolean find ( Key_Type, Table );

int getX ( Key_Type, Table );

int getY ( Key_Type, Table );

void print_table ( Table );

/************************************************************************/
/*************************** VARIABLES **********************************/
/************************************************************************/

Table movesHashTable;		/* The table of opening moves */

#endif

/*                                                                      */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
/*                     end of hashing.h                             */
/************************************************************************/

