-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe8c27e
commit 6b5f98b
Showing
5 changed files
with
211 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,37 @@ | ||
/** Implemented technics: | ||
* | ||
* minimax | ||
* a-b pruning | ||
* quiescence search | ||
* Transposition table | ||
* MTD(F) | ||
* Iterative Deepening | ||
*/ | ||
|
||
//player that does random moves! | ||
void random_move(); | ||
|
||
//player based on AI theory | ||
void ai_move(); | ||
|
||
/* used from evaluate function...*/ | ||
typedef struct{ | ||
int food; | ||
int queens; | ||
int soldiers; | ||
int unprotected_soldiers; | ||
/****white player wants to maximaze and black player wants to minimaze | ||
* | ||
* gain 100 points for each ant that you own | ||
* gain points for the depth (in board ) of each ant | ||
* | ||
* lose 100 points for each ant that the opponent own | ||
* lose points for the depth (in board ) of each opponent's ant | ||
* | ||
* pos -> score*90 because score has queens and food | ||
*/ | ||
int evaluate_function(Position* pos); | ||
|
||
//soldiers that are threatened... | ||
int in_danger_soldiers; | ||
/* | ||
*It is an extension of the evaluation function to defer evaluation until the position is stable enough to be evaluated | ||
* enough to be evaluated means no jump available | ||
*/ | ||
int quiescence_search(Position* pos) | ||
|
||
//how many soldiers this playes threatens | ||
int threatening_soldiers; | ||
} PlayerInfo; | ||
/** | ||
* Weigths on each parameter of PlayerInfo | ||
/*** Main function of the agent | ||
* | ||
*/ | ||
//evaluates a state based on PlayerInfo | ||
int evaluate_function(); | ||
Move* make_move(Position* pos, int depth); | ||
|
||
int iterativeDeepening(Position* pos, Move* agent_move); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include "mlist.h" | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
/* | ||
* This is a list with moves that is used in the agent (client.c) | ||
*/ | ||
|
||
//creates an empty list | ||
void initList(mlist* list_pointers){ | ||
list_pointers -> head = NULL; | ||
list_pointers -> tail = NULL; | ||
} | ||
|
||
//push a Move to the list | ||
void push(mlist* list_pointers, Move* data){ | ||
node* n =(node*) malloc(sizeof(node)); | ||
n->data = data; | ||
n->next = list_pointers -> head; | ||
|
||
if(list_pointers -> head == NULL) | ||
list_pointers -> tail = n; | ||
list_pointers -> head = n; | ||
} | ||
|
||
//get data of the first Moce | ||
Move* peek(mlist* list_pointers){ | ||
if(list_pointers == NULL || list_pointers->head == NULL) | ||
return NULL; | ||
return list_pointers -> head -> data; | ||
} | ||
|
||
//Pop a move | ||
Move* pop(mlist* list_pointers){ | ||
if(list_pointers == NULL || list_pointers -> head == NULL) | ||
return NULL; | ||
Move* move_data; | ||
|
||
node* n = list_pointers -> head; | ||
list_pointers -> head = list_pointers -> head -> next; | ||
//empty list | ||
if(list_pointers -> head == NULL) | ||
list_pointers->tail = NULL; | ||
move_data = n->data; | ||
|
||
free(n); | ||
|
||
return move_data; | ||
} | ||
|
||
|
||
void freeList(mlist* list_pointers){ | ||
while(list_pointers -> head != NULL) | ||
free(pop(list_pointers)); | ||
free(list_pointers); | ||
} | ||
void emptyList(mlist* list_pointers){ | ||
while(list_pointers -> head != NULL) | ||
free(pop(list_pointers)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "move.h" | ||
|
||
/* | ||
* This is a list with moves that is used in the agent (client.c) | ||
*/ | ||
|
||
typedef struct node{ | ||
Move* data; | ||
struct node *next; | ||
} node; | ||
|
||
|
||
typedef struct { | ||
node *head; | ||
node *tail; | ||
} mlist; | ||
|
||
|
||
void initList(mlist* list_pointers); | ||
void push(mlist* list_pointers, Move* data); | ||
Move* peek(mlist* list_pointers); | ||
Move* pop(mlist* list_pointers); | ||
|
||
void freeList(mlist*); | ||
|
||
void emptyList(mlist*); |