Line 346... |
Line 346... |
//FIFO_INTERFACE(queue,AIMove);
|
//FIFO_INTERFACE(queue,AIMove);
|
#pragma fifo_length pico_stream_input_queue 800
|
#pragma fifo_length pico_stream_input_queue 800
|
#pragma fifo_length pico_stream_output_queue 800
|
#pragma fifo_length pico_stream_output_queue 800
|
#pragma bandwidth pico_stream_input_queue 1
|
#pragma bandwidth pico_stream_input_queue 1
|
#pragma bandwidth pico_stream_output_queue 1
|
#pragma bandwidth pico_stream_output_queue 1
|
/*AIMoves*/int ai_threats(Board board[2][16],int depth,int branch,AIMoves moves[2][16],index_array *index)
|
/*AIMoves*/int ai_threats(Board board[2][16],int depth,int branch,AIMoves moves[2][16]/*,index_array *index*/)
|
{
|
{
|
//#pragma read_write_ports board.data combined 2
|
//#pragma read_write_ports board.data combined 2
|
//#pragma internal_blockram board
|
//#pragma internal_blockram board
|
//#pragma no_memory_analysis board
|
//#pragma no_memory_analysis board
|
|
|
//#pragma internal_blockram move
|
//#pragma internal_blockram move
|
//#pragma no_memory_analysis move
|
//#pragma no_memory_analysis move
|
|
index_array index={0};
|
#pragma internal_fast index
|
#pragma internal_fast index
|
|
|
/////////* All threat functions work on this board */
|
/////////* All threat functions work on this board */
|
/*static*/ Board b;//={0,0,0,0,0,0,0,0,0,0,0,{{0}}} ;//= NULL;
|
/*static*/ Board b;//={0,0,0,0,0,0,0,0,0,0,0,{{0}}} ;//= NULL;
|
//#pragma read_write_ports b.data combined 2
|
//#pragma read_write_ports b.data combined 2
|
Line 530... |
Line 531... |
AIMoves moves1;
|
AIMoves moves1;
|
moves1.len=0;
|
moves1.len=0;
|
#pragma internal_blockram moves1
|
#pragma internal_blockram moves1
|
/*moves = */ ai_marks(&bwrite, PIECE_THREAT(1),&moves1);
|
/*moves = */ ai_marks(&bwrite, PIECE_THREAT(1),&moves1);
|
//test(ready);
|
//test(ready);
|
streamsort(&moves[depth][branch],index);
|
streamsort(&moves[depth][branch],&index);
|
moves1.utility = u_sum;
|
moves1.utility = u_sum;
|
moves[depth][branch].utility = u_sum;
|
moves[depth][branch].utility = u_sum;
|
/*----------------------------
|
/*----------------------------
|
rewritten for hardware
|
rewritten for hardware
|
----------------------------*/
|
----------------------------*/
|
Line 806... |
Line 807... |
//AIMoves *moves;
|
//AIMoves *moves;
|
moves.len=0;
|
moves.len=0;
|
/* Get all open tiles adjacent to any piece */
|
/* Get all open tiles adjacent to any piece */
|
/*moves =*/ enum_adjacent(b, 1,&moves,current_random);
|
/*moves =*/ enum_adjacent(b, 1,&moves,current_random);
|
if (moves.len){
|
if (moves.len){
|
aimoves_choose(&moves, move,&index);
|
aimoves_choose(&moves, move/*,&index*/);
|
|
|
return ;//moves;
|
return ;//moves;
|
}
|
}
|
/* Play in the middle if there are no open adjacent tiles */
|
/* Play in the middle if there are no open adjacent tiles */
|
move->x = board_size / 2;
|
move->x = board_size / 2;
|