给倒水小游戏写的暴力破解exe

游戏:
请添加图片描述
简单的DFS搜索。
这个代码一个缺点是要倒着看,另一个缺点是有两个瓶子装着同一种颜色并且可以操作时,如果在它们前面还有一个空瓶子时,会先倒进空瓶子,再倒进该倒进的瓶子。
最后一个缺点是过于暴力,毫无策略(反正人类玩的十来个瓶子的场景肯定没问题)。

#include <iostream>
#include <vector>
#include <map>

using namespace std;

int N, max_Volunm, not_empty;
vector<vector<int>> scene;

void printScene(vector<vector<int>> s) {
	for (int i = max_Volunm - 1; i >= 0; i--) {
		for (int j = 0; j < N; j++) {
			if (s[j].size() <= i)
				cout << "- ";
			else
				cout << s[j][s[j].size() - i - 1] << " ";
		}
		cout << endl;
	}
}

bool checkState() {
	for (auto s : scene)
	{
		if (s.size() == 0)
			continue;
		if (s.size() < max_Volunm)
			return false;
		int c = s[0];
		for (auto c_in_s : s) {
			if (c_in_s != c)
				return false;
		}
	}
	printScene(scene);
	return true;
}

bool getResult() {
	if (checkState())
		return true;
	for (int i1 = 0; i1 < scene.size(); i1++) {
		auto& s1 = scene[i1];
		if (s1.size() == 0)
			continue;
		for (int i2 = 0; i2 < scene.size(); i2++) {
			auto& s2 = scene[i2];
			if (s1 == s2)
				continue;
			if (s2.size() == 0 || *(s1.begin()) == *(s2.begin()))
			{
				auto old_scene = scene;
				auto old_s1 = s1, old_s2 = s2;
				int same_color = *(s1.begin());
				bool flag = true;
				reverse(s2.begin(), s2.end());
				while (s1.size() > 0 && *(s1.begin()) == same_color) {
					if (s2.size() >= max_Volunm) {
						flag = false;
						break;
					}
					s1.erase(s1.begin());
					s2.push_back(same_color);
				}
				reverse(s2.begin(), s2.end());
				if (s2 != old_s1 && s1 != old_s2 && flag && getResult()) {
					cout << i1 << "->" << i2 << endl;
					printScene(old_scene);
					return true;
				}
				scene = old_scene;
			}
		}
	}
	return false;
}

int main()
{
	cin >> N >> max_Volunm>>not_empty;
	scene.resize(N);
	for (int i = 0; i < not_empty; i++) {
		for (int j = 0; j < max_Volunm; j++) {
			int in;
			cin >> in;
			scene[i].push_back(in);
		}
	}
	getResult();
	while (true);
}
### 倒水小游戏的关卡设计策划方案 倒水小游戏是一种基于物理模拟的游戏类型,通常涉及玩家通过倾倒容器中的液体来完成特定目标。以下是针对此类游戏的一个完整的关卡设计策划方案。 #### 1. **核心玩法机制** 游戏的核心在于利用重力和流体力学原理解决谜题。玩家需要在一个限定的空间内操作多个容器,调整它们的位置以实现指定的目标(如填满某个杯子到一定刻度)。这种设计可以激发玩家的逻辑思维能力和空间感知能力[^2]。 #### 2. **关卡结构规划** - **初级阶段**: 设计简单场景,仅提供两个或三个容器以及少量障碍物。目的是让新玩家熟悉基本的操作方式。 ```python level_1 = { 'containers': ['small', 'medium'], 'target_volume': 50, 'obstacles': [] } ``` - **中级阶段**: 引入更多复杂因素,比如不同形状的容器、倾斜角度变化或者动态移动平台等元素增加难度。 - **高级阶段**: 结合时间限制、特殊道具(例如漏斗)、多层地形等因素进一步挑战用户的策略制定能力。 #### 3. **视觉与音效设计** 为了增强用户体验,在图形表现上应采用明亮色彩搭配简洁线条风格;同时加入适量背景音乐及交互反馈声音效果提升沉浸感[^3]. ```javascript // Example of sound effect implementation in JavaScript function playSound(soundFile){ var audioElement = document.createElement('audio'); audioElement.src = soundFile; audioElement.play(); } playSound('./sounds/splash.mp3'); // Play splash sound when water hits target area. ``` #### 4. **技术实现要点** 使用Unity引擎配合其内置PhysX physics system能够很好地支持这类基于现实世界规则模拟的应用程序开发工作流程;另外还可以考虑集成第三方插件扩展功能特性满足个性化需求[^4]. ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值