Commit 6e9f6b34 authored by royus's avatar royus

fix

parent 4795667d
No preview for this file type
/* solver.c */ /* solver.c */
/* Last Change: 2019/07/25 (Thu) 14:39:28. */ /* Last Change: 2019/07/29 (Mon) 09:32:40. */
#include<stdio.h> #include<stdio.h>
#include<limits.h> #include<limits.h>
...@@ -151,10 +151,23 @@ short int search_placable(short int blockid){ //calc the cost (sum of Euclidean ...@@ -151,10 +151,23 @@ short int search_placable(short int blockid){ //calc the cost (sum of Euclidean
short int i,j,k,l,index=0; short int i,j,k,l,index=0;
short int place[5][2]; //(relative) place of edge #block_data[blockid][1-4][] (x,y) short int place[5][2]; //(relative) place of edge #block_data[blockid][1-4][] (x,y)
short int blockw=0,blockh=0; short int blockw=0,blockh=0;
/* calc cost */
if(block_data[blockid][2][2]==-1){ //if monomino if(block_data[blockid][2][2]==-1){ //if monomino
return 1; for(i=0;i<MAXSIZE;i++)
for(j=0;j<MAXSIZE;j++){
cost[i][j][0]=0;
if(board_beta[i][j]==block_data[blockid][1][2]){
if(i+1<MAXSIZE&&board_beta[i+1][j]==0)
cost[i+1][j][0]=1;
if(j+1<MAXSIZE&&board_beta[i][j+1]==0)
cost[i][j+1][0]=1;
if(i-1>=0&&board_beta[i-1][j]==0)
cost[i-1][j][0]=1;
if(j-1>=0&&board_beta[i][j-1]==0)
cost[i][j-1][0]=1;
} }
/* calc cost */ }
}else{
for(k=1;k<=4;k++){ for(k=1;k<=4;k++){
place[k][0]=SHRT_MIN; place[k][0]=SHRT_MIN;
place[k][1]=SHRT_MIN; place[k][1]=SHRT_MIN;
...@@ -199,6 +212,7 @@ short int search_placable(short int blockid){ //calc the cost (sum of Euclidean ...@@ -199,6 +212,7 @@ short int search_placable(short int blockid){ //calc the cost (sum of Euclidean
} }
} }
} }
}
/* calc costrank */ /* calc costrank */
for(i=0;i<MAXSIZE;i++) for(i=0;i<MAXSIZE;i++)
for(j=0;j<MAXSIZE;j++) for(j=0;j<MAXSIZE;j++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment