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

Subversion Repositories connect-6

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /connect-6
    from Rev 10 to Rev 11
    Reverse comparison

Rev 10 → Rev 11

/trunk/BUILD_SCC/synth_src/state.cpp
223,17 → 223,17
int top;
AIMoves moves1;
#pragma bitsize i 4
// if (!moves || !moves->len)
// return 0;
// //aimoves_sort(moves);
// for (top = 0; top < moves->len &&
// moves->data[top].weight == moves->data[0].weight; top++);
// if (top)
// //i = my_irand(top,current_random);//g_random_int_range(0, top);
// i=0;
//
// *move = moves->data[i];
// return 1;
if (!moves || !moves->len)
return 0;
aimoves_sort(moves);
for (top = 0; top < moves->len &&
moves->data[top].weight == moves->data[0].weight; top++);
if (top)
//i = my_irand(top,current_random);//g_random_int_range(0, top);
i=0;
*move = moves->data[i];
return 1;
/*---------------------------------------
Rewritten for Hardware
---------------------------------------*/
253,7 → 253,7
//}
// return 0;
if(!moves|| !moves->len) return 0;
else {*move=moves->data[index[i]];return 1;}
else {*move=moves->data[i];return 1;}
 
 
}
/trunk/BUILD_SCC/synth_src/connect6_synth.cpp
173,8 → 173,8
//#pragma num_iterations(1,2,2)
//#pragma unroll
Player player;
player.depth=1;
player.branch=1;
player.depth=3;
player.branch=2;
for(i=myboard.moves_left;i>0;i--){
//aimoves_free(&moves);
move.x=-1;
/trunk/BUILD_SCC/synth_src/main.cpp
219,7 → 219,7
connect6ai(board,AI_colour,move);
movecount++;
cout<<"AI MOVE: "<<move[0]<<move[1]<<move[2]<<move[3]<<endl;
if(movecount >=20) return 0 ; //reducing length of simulation
//if(movecount >=20) return 0 ; //reducing length of simulation
winning_colour = check_for_win(board);
if (winning_colour == AI_colour){
cout<<"AI has won! " << movecount << " moves " << "Exiting."<<endl;
/trunk/BUILD_SCC/synth_src/search.cpp
8,6 → 8,8
//#include "config.h"
//#include <string.h>
//#include <glib.h>
//#include <iostream>
#include <stdio.h>
#include "./shared.h"
#include "pico.h"
//#include "../connectk.h"
36,6 → 38,7
/* Alpha-beta sanity check */
if (alpha >= beta) {
//g_warning("DFS alpha-beta failed sanity check");
//printf("DFS alpha-beta failed sanity check\n");
return moves->utility;
}
 
54,7 → 57,7
 
/* Search each move available in depth first order */
for (i = 0; i < moves->len; i++) {
static Board b_next;
Board b_next;
AIMove *aim = moves->data + i;
AIMoves moves_next;
 
62,6 → 65,7
if (!piece_empty(piece_at(b, aim->x, aim->y))) {
//g_warning("DFS utility function suggested a bad move "
//"(%s)", bcoords_to_string(aim->x, aim->y));
//printf("bad move\n");
continue;
}
 
102,6 → 106,7
// return moves->utility;
//}
//moves_next = func(b_next);
printf("depth %d branch %d player %d moves_left %d alpha %d MOVE %d %d \n",depth,i,b_next.turn,b_next.moves_left,alpha,aim->y+1,aim->x+1);
ai_threats(&b_next,&moves_next,index);
aim->weight = df_search(&b_next, &moves_next, index,player,
/trunk/BUILD_SCC/synth_src/threats.cpp
550,7 → 550,7
----------------------------*/
//board_free(b);
//return moves;
//return 0;
return 1;
}
 
//void debug_counts(void)
727,16 → 727,16
else if(val.weight==-100) continue;
#pragma num_iterations(0,150,361)
for(i=0;i<len;i++){
if (moves->data[index[i]].weight < val.weight){
if (moves->data[i].weight < val.weight){
for(j=len-1;j>i-1;j--){
//moves->data[j+1]=moves->data[j];
index[j+1]=index[j];
moves->data[j+1]=moves->data[j];
//index[j+1]=index[j];
}
break;
}
}
index[i]=len;
moves->data[len]=val;
moves->data[i]=val;
len++;
//cout<<"STREAMSORT"<<":";
//}
/trunk/BUILD_SCC/synth_src/shared.h
281,7 → 281,7
 
typedef int AIWEIGHT;
/* Type for AI move weights (utilities) */
#pragma bitsize AIWEIGHT 32
#pragma bitsize AIWEIGHT 64
 
typedef struct {
AIWEIGHT weight;

powered by: WebSVN 2.1.0

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