⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 safe.cpp

📁 农夫过河的扩展
💻 CPP
字号:

int farmer(int location){
	return(0!=(location&0x20));
}

int ob1(int location){
	return(0!=(location&0x10));
}

int ob2(int location){
	return(0!=(location&0x08));
}

int ob3(int location){
	return(0!=(location&0x04));
}

int ob4(int location){
	return(0!=(location&0x02));
}

int ob5(int location){
	return(0!=(location&0x01));
}

int isSafe(int location){
	if (ob1(location)==ob2(location)&&
		ob1(location)!=farmer(location))
		return 0;
	if (ob2(location)==ob4(location)&&
		ob2(location)!=farmer(location))
		return 0;
	if (ob1(location)==ob3(location)&&
		ob1(location)!=farmer(location))
		return 0;
	if (ob3(location)==ob5(location)&&
		ob3(location)!=farmer(location))
		return 0;
	return 1;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -