如何在C ++中使用链接列表创建地图 [英] how to create a map using link list in c++

查看:96
本文介绍了如何在C ++中使用链接列表创建地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个简单的游戏,该游戏在地图中具有移动的bot,并将保留在该地图的边界内.这个想法是使用链接列表创建地图.

i am making simple game which has a moving bot in the map and will remain within the boundary of that map the idea is create a map using link list

推荐答案

我实际上有一些有趣的建议,但是如果它不能帮助您获得立竿见影或更好的结果,请不要怪.从评论的角度来看,我认为您的游戏正在使用谨慎的元胞自动机(因为您讨论的是沿4方向或8方向移动,依此类推).

这是主意.您应该知道一个流行的游戏:约翰·霍顿·康威(John Horton Conway)发明的人生游戏( http://en.wikipedia. org/wiki/Conway''s_Game_of_Life [ ^ ]).

游戏本身可能与您的游戏相去甚远,但1)它非常受欢迎,因此人们创建了许多实现,其中一些非常好; 2)在这款游戏的编程中,只有一个真正的挑战:如何以数据结构呈现游戏场景并将其映射到屏幕上-这正是您在考虑的问题.有人设计出了非常聪明的方法来做这件事.如果您想研究此类代码的设计,那么您肯定会找到想要的.

那呢?

祝你好运.
—SA
I actually have some interesting suggestion, but please don''t blame if it does not help you to get immediate or better results. From the context of comments I think your game is working with discreet cellular automaton (because you discuss move in 4 direction or 8 and so on).

Here is the idea. There is one popular game you should know: a Game of Life invented by John Horton Conway (http://en.wikipedia.org/wiki/Conway''s_Game_of_Life[^]).

The game itself is maybe quite far from yours but 1) it is very popular, so people created a lot of implementations, some of them are very good; 2) in the programming of this game, there is only one real challenge: how to present the game scene in data structures and map them on screen — this is exactly what are you thinking about. Some people devised really clever ways of doing this thing. If you want to research designs of such codes you will certainly find all you want.

How about that?

Good luck.
—SA


太好了!听起来您完成游戏后会觉得很有趣!

但是您有一个特定的问题吗?您到底在遇到什么问题?
That''s great! Sounds like you''ll have a lot of fun with that game when you''re finished!

But did you have a specific question? What exactly are you having problems with?


这篇关于如何在C ++中使用链接列表创建地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆