//#include “snake.h”
#include "string"
#include "iostream"
using namespace std;
int info[2];
int times=0; //回合
int tie=0; //大于10的回合0-3
int snakelen=1; //蛇的长度(对应数组的下标要减1)
int qiju[14][18]; //棋局
int quanzhi[14][18];
int mylen[200];
int enlen[200];
//初始化棋局
void inita(int n,int m,int x[],int len){
int i,j;
for(i=0;i<n;i++){
for(j=0;j<m;j++){
qiju[i][j]=0;
quanzhi[i][j]=0;
}
}
for(i=0;i<len;i++){
qiju[x[i]/100-1][x[i]%100-1]=4;
}
return;
}
//双方棋局
void drawqiju(){
for(int i=0;i<snakelen;i++){
qiju[mylen[i]/100-1][mylen[i]%100-1]=1;
qiju[enlen[i]/100-1][enlen[i]%100-1]=2;
}
}
//估分函数
void valueofquanzhi(int direction){
}
//生成方向
int choosediretion(){
return 1;
}
//__declspec (dllexport)
void init(int no,int n,int m,int x[],int len){
info[0]=n;info[1]=m;
inita(n,m,x,len);
//双方初始位置
mylen[0]=(no==0)?101:n*100+m;
enlen[0]=(no==0)?n*100+m:101;
drawqiju();
return;
}
//__declspec (dllexport)
int run(int direction){
if(times==0){
times++;
return choosediretion();
}
if(times>10){
if(tie==3){
tie=0;
}
tie++;
}
//int dir=valueofquanzhi(direction);
times++;
return 1;//dir;
}
int main(){
int no=1;
int n=12,m=13;
int x[3]={1008,1003,811};
int len=3;
init(no,n,m,x,len);
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cout<<qiju[i][j]<<" ";
}
cout<<endl;
}
cout<<mylen[0]<<endl;
return 0;
}
#include "string"
#include "iostream"
using namespace std;
int info[2];
int times=0; //回合
int tie=0; //大于10的回合0-3
int snakelen=1; //蛇的长度(对应数组的下标要减1)
int qiju[14][18]; //棋局
int quanzhi[14][18];
int mylen[200];
int enlen[200];
//初始化棋局
void inita(int n,int m,int x[],int len){
int i,j;
for(i=0;i<n;i++){
for(j=0;j<m;j++){
qiju[i][j]=0;
quanzhi[i][j]=0;
}
}
for(i=0;i<len;i++){
qiju[x[i]/100-1][x[i]%100-1]=4;
}
return;
}
//双方棋局
void drawqiju(){
for(int i=0;i<snakelen;i++){
qiju[mylen[i]/100-1][mylen[i]%100-1]=1;
qiju[enlen[i]/100-1][enlen[i]%100-1]=2;
}
}
//估分函数
void valueofquanzhi(int direction){
}
//生成方向
int choosediretion(){
return 1;
}
//__declspec (dllexport)
void init(int no,int n,int m,int x[],int len){
info[0]=n;info[1]=m;
inita(n,m,x,len);
//双方初始位置
mylen[0]=(no==0)?101:n*100+m;
enlen[0]=(no==0)?n*100+m:101;
drawqiju();
return;
}
//__declspec (dllexport)
int run(int direction){
if(times==0){
times++;
return choosediretion();
}
if(times>10){
if(tie==3){
tie=0;
}
tie++;
}
//int dir=valueofquanzhi(direction);
times++;
return 1;//dir;
}
int main(){
int no=1;
int n=12,m=13;
int x[3]={1008,1003,811};
int len=3;
init(no,n,m,x,len);
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cout<<qiju[i][j]<<" ";
}
cout<<endl;
}
cout<<mylen[0]<<endl;
return 0;
}