Line 190... |
Line 190... |
p = piece_at(b, x, y);
|
p = piece_at(b, x, y);
|
if (!piece_empty(p))
|
if (!piece_empty(p))
|
return 0;
|
return 0;
|
|
|
/* Push forward the maximum and find the window type */
|
/* Push forward the maximum and find the window type */
|
//#pragma unroll
|
#pragma unroll
|
//#pragma num_iterations(1,3,6)
|
#pragma num_iterations(1,3,6)
|
for (maximum = 1; maximum < connect_k; maximum++) {
|
for (maximum = 1; maximum < connect_k; maximum++) {
|
p = piece_at(b, x + dx * maximum, y + dy * maximum);
|
p = piece_at(b, x + dx * maximum, y + dy * maximum);
|
if (p == PIECE_ERROR)
|
if (p == PIECE_ERROR)
|
break;
|
break;
|
if (!piece_empty(p)) {
|
if (!piece_empty(p)) {
|
Line 207... |
Line 207... |
}
|
}
|
}
|
}
|
maximum--;
|
maximum--;
|
|
|
/* Try to push the entire window back */
|
/* Try to push the entire window back */
|
//#pragma unroll
|
#pragma unroll
|
//#pragma num_iterations(1,3,6)
|
#pragma num_iterations(1,3,6)
|
for (minimum = -1; minimum > -connect_k; minimum--) {
|
for (minimum = -1; minimum > -connect_k; minimum--) {
|
p = piece_at(b, x + dx * minimum, y + dy * minimum);
|
p = piece_at(b, x + dx * minimum, y + dy * minimum);
|
if (p == PIECE_ERROR || piece_empty(p))
|
if (p == PIECE_ERROR || piece_empty(p))
|
break;
|
break;
|
if (type == PIECE_NONE)
|
if (type == PIECE_NONE)
|
Line 231... |
Line 231... |
|
|
/* Push back minimum if we haven't formed a complete window, this window
|
/* Push back minimum if we haven't formed a complete window, this window
|
can't be a double */
|
can't be a double */
|
if (maximum - minimum < connect_k - 1) {
|
if (maximum - minimum < connect_k - 1) {
|
//#pragma unroll
|
//#pragma unroll
|
//#pragma num_iterations(1,3,6)
|
#pragma num_iterations(1,3,6)
|
for (minimum--; minimum > maximum - connect_k; minimum--) {
|
for (minimum--; minimum > maximum - connect_k; minimum--) {
|
p = piece_at(b, x + dx * minimum, y + dy * minimum);
|
p = piece_at(b, x + dx * minimum, y + dy * minimum);
|
if (p == PIECE_ERROR)
|
if (p == PIECE_ERROR)
|
break;
|
break;
|
if (!piece_empty(p)) {
|
if (!piece_empty(p)) {
|
Line 274... |
Line 274... |
//static int threat_counts[MAX_CONNECT_K + 1][2];
|
//static int threat_counts[MAX_CONNECT_K + 1][2];
|
threat_count_array threat_counts={{0}};
|
threat_count_array threat_counts={{0}};
|
#pragma internal_fast threat_counts
|
#pragma internal_fast threat_counts
|
//#pragma read_write_ports threat_counts.data combined 2
|
//#pragma read_write_ports threat_counts.data combined 2
|
//#pragma no_memory_analysis threat_counts
|
//#pragma no_memory_analysis threat_counts
|
if (k==1) board_copy(b, bwrite);
|
//if (k==1) board_copy(b, bwrite);
|
int i;
|
int i;
|
AIWEIGHT weight = 0;
|
AIWEIGHT weight = 0;
|
///* Clear threat tallys */
|
///* Clear threat tallys */
|
//for (i = 0; i < connect_k; i++) {
|
//for (i = 0; i < connect_k; i++) {
|
// threat_counts.data[i][0] = 1;
|
// threat_counts.data[i][0] = 1;
|
Line 365... |
Line 365... |
//#pragma read_write_ports b.data separate 1 readonly 2 writeonly
|
//#pragma read_write_ports b.data separate 1 readonly 2 writeonly
|
//#pragma no_memory_analysis b
|
//#pragma no_memory_analysis b
|
/*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 2
|
//#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
|
Line 513... |
Line 513... |
break;
|
break;
|
}
|
}
|
}
|
}
|
|
|
|
|
|
if (k==1) board_copy(&b, &bwrite);
|
u_sum += threat_line(arg1, arg2, arg3, arg4,&b,&bwrite,k,loop_bound);
|
u_sum += threat_line(arg1, arg2, arg3, arg4,&b,&bwrite,k,loop_bound);
|
}
|
}
|
}
|
}
|
//PICO_sync_task(id, 1);
|
//PICO_sync_task(id, 1);
|
//PICO_finalize_PPA(id);
|
//PICO_finalize_PPA(id);
|
Line 710... |
Line 711... |
// else break;
|
// else break;
|
// //if(!moves_fifo.active && moves_fifo.empty()) break;
|
// //if(!moves_fifo.active && moves_fifo.empty()) break;
|
// }
|
// }
|
//while(1) {
|
//while(1) {
|
//int count=0;
|
//int count=0;
|
#pragma num_iterations(1,150,1362)
|
#pragma num_iterations(1,150,368)
|
for(k=0;k<1362;k++){
|
for(k=0;k<368;k++){
|
//count++;
|
//count++;
|
//cout<<count<<endl;
|
//cout<<count<<endl;
|
if (k>1000){
|
if (k>6){
|
|
|
//if(ready>5){
|
//if(ready>5){
|
val=pico_stream_input_queue();
|
val=pico_stream_input_queue();
|
//cout<<"popped"<<","<<val.weight<<" "<<val.x<<" "<<val.y<<endl;
|
//cout<<"popped"<<","<<val.weight<<" "<<val.x<<" "<<val.y<<endl;
|
if(val.weight==-1) {moves->len=len;break;}
|
if(val.weight==-1) {moves->len=len;break;}
|