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

Subversion Repositories connect-6

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

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

Rev 4 Rev 7
Line 21... Line 21...
#include <termios.h>
#include <termios.h>
#include <sys/time.h>
#include <sys/time.h>
#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 <serialport>
// commandline option: -port <serialport>
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(connect6ai_synth);
        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: "<<move[0]<<move[1]<<move[2]<<move[3]<<endl;
        cout<<"AI MOVE: "<<move[0]<<move[1]<<move[2]<<move[3]<<endl;
 
        //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."<<endl;
            cout<<"AI has won! " << movecount << " moves " << "Exiting."<<endl;
            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;
 
 
}
}
 
 
 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.