Line 21... |
Line 21... |
#include
|
#include
|
#include
|
#include
|
#include "util.h"
|
#include "util.h"
|
#include "connect6.h"
|
#include "connect6.h"
|
#include "connect6_synth.h"
|
#include "connect6_synth.h"
|
//#include "pico.h"
|
#include "pico.h"
|
//#include "shared.h"
|
#include "shared.h"
|
|
|
// The AI has as much time as it wants, but moves after 1 second. Default is to wait 2 seconds
|
// The AI has as much time as it wants, but moves after 1 second. Default is to wait 2 seconds
|
#define AI_WAIT_TIME 0.1
|
#define AI_WAIT_TIME 0.1
|
|
|
// FPGA has 1 second to make its move
|
// FPGA has 1 second to make its move
|
#define MOVE_TIME_LIMIT 0.1
|
#define MOVE_TIME_LIMIT 0.1
|
|
|
using namespace std;
|
using namespace std;
|
|
extern "C" int main(int argc, char **argv);
|
// commandline option: -port
|
// commandline option: -port
|
int main(int argc, char **argv){
|
int main(int argc, char **argv){
|
//for verification two runs and a reference board
|
//for verification two runs and a reference board
|
int i,j,k;
|
int i,j,k;
|
char ref_board[19][19] = {{ 0 }};
|
char ref_board[19][19] = {{ 0 }};
|
Line 51... |
Line 51... |
// Get the serial port
|
// Get the serial port
|
//int port = select_com_port(argc,argv);
|
//int port = select_com_port(argc,argv);
|
// Get software AI's colour
|
// Get software AI's colour
|
char AI_colour = select_AI_colour(argc,argv);
|
char AI_colour = select_AI_colour(argc,argv);
|
char FPGA_colour;
|
char FPGA_colour;
|
//int id = PICO_initialize_PPA(\TCAB_NAME);
|
int id = PICO_initialize_PPA(connect6ai_synth);
|
// Take care of the first few moves (including sending the colour)
|
// Take care of the first few moves (including sending the colour)
|
if (AI_colour == 'D'){
|
if (AI_colour == 'D'){
|
FPGA_colour = 'L';
|
FPGA_colour = 'L';
|
//write(port, "L",1);
|
//write(port, "L",1);
|
|
|
Line 217... |
Line 217... |
|
|
// AI makes a move
|
// AI makes a move
|
connect6ai(board,AI_colour,move);
|
connect6ai(board,AI_colour,move);
|
movecount++;
|
movecount++;
|
cout<<"AI MOVE: "<
|
cout<<"AI MOVE: "<
|
|
if(movecount >=20) return 0 ; //reducing length of simulation
|
winning_colour = check_for_win(board);
|
winning_colour = check_for_win(board);
|
if (winning_colour == AI_colour){
|
if (winning_colour == AI_colour){
|
cout<<"AI has won! " << movecount << " moves " << "Exiting."<
|
cout<<"AI has won! " << movecount << " moves " << "Exiting."<
|
break;
|
break;
|
} else if (winning_colour == FPGA_colour){
|
} else if (winning_colour == FPGA_colour){
|
Line 267... |
Line 268... |
moveport[7]=move[3];
|
moveport[7]=move[3];
|
print_board(board);
|
print_board(board);
|
print_board_file(board);
|
print_board_file(board);
|
}
|
}
|
|
|
//PICO_finalize_PPA(id);
|
PICO_finalize_PPA(id);
|
|
|
return 0;
|
return 0;
|
|
|
}
|
}
|