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,AIMove *move)
|
/*AIMoves*/int ai_threats(Board *board,AIMoves *moves,unsigned int *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
|
|
|
Line 367... |
Line 367... |
/*static*/ Board bwrite;//={0,0,0,0,0,0,0,0,0,0,0,{{0}}} ;//= NULL;
|
/*static*/ Board bwrite;//={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
|
#pragma internal_blockram bwrite
|
#pragma internal_blockram bwrite
|
//#pragma multi_buffer bwrite 22
|
//#pragma multi_buffer bwrite 22
|
//#pragma no_memory_analysis b
|
//#pragma no_memory_analysis b
|
/*static*/ AIMoves moves;//={0,0,0,{{0,0,0}}};
|
///*static*/ AIMoves moves;//={0,0,0,{{0,0,0}}};
|
//#pragma read_write_ports moves.data combined 3
|
//#pragma read_write_ports moves.data combined 3
|
#pragma internal_blockram moves
|
#pragma internal_blockram moves
|
//#pragma no_memory_analysis moves
|
//#pragma no_memory_analysis moves
|
|
|
moves.len=0;
|
moves->len=0;
|
//AIMoves moves;
|
//AIMoves moves;
|
AIWEIGHT u_sum = 0;
|
AIWEIGHT u_sum = 0;
|
int i;
|
int i;
|
|
|
//b = board_new();
|
//b = board_new();
|
Line 521... |
Line 521... |
}
|
}
|
//PICO_sync_task(id, 1);
|
//PICO_sync_task(id, 1);
|
//PICO_finalize_PPA(id);
|
//PICO_finalize_PPA(id);
|
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
//board_copy(&b,&b_marks);
|
//board_copy(&b,&b_marks);
|
unsigned int index[max_size]={0};
|
//unsigned int index[max_size]={0};
|
#pragma bitsize index 9
|
#pragma bitsize index 9
|
#pragma internal_fast index
|
#pragma internal_fast index
|
AIMoves moves1;
|
AIMoves moves1;
|
|
moves1.len=0;
|
#pragma internal_blockram moves1
|
#pragma internal_blockram moves1
|
/*moves = */ ai_marks(&bwrite, PIECE_THREAT(1),&moves);
|
/*moves = */ ai_marks(&bwrite, PIECE_THREAT(1),&moves1);
|
//test(ready);
|
//test(ready);
|
streamsort(&moves1,&index[0]);
|
streamsort(moves,index);
|
//moves1.utility = u_sum;
|
moves1.utility = u_sum;
|
//moves.utility = u_sum;
|
moves->utility = u_sum;
|
/*----------------------------
|
/*----------------------------
|
rewritten for hardware
|
rewritten for hardware
|
----------------------------*/
|
----------------------------*/
|
//if (!aimoves_choose(&moves1, move))
|
//if (!aimoves_choose(&moves1, move))
|
// return 0;
|
// return 0;
|
//else return 1;
|
//else return 1;
|
int ret_val;
|
//int ret_val;
|
ret_val=aimoves_choose(&moves1, move,&index[0]);
|
//ret_val=aimoves_choose(&moves1, move,&index[0]);
|
if (!ret_val)
|
//if (!ret_val)
|
return 0;
|
// return 0;
|
else return 1;
|
//else return 1;
|
/*----------------------------
|
/*----------------------------
|
end rewritten for hardware
|
end rewritten for hardware
|
----------------------------*/
|
----------------------------*/
|
//board_free(b);
|
//board_free(b);
|
//return moves;
|
//return moves;
|