生活的游戏与门面设计模式 [英] Game of life with facade design pattern

查看:177
本文介绍了生活的游戏与门面设计模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该为游戏生活问题提出解决方案。我决定通过门面设计模式实现。

I was supposed to come up with a solution for the game of life problem. I decided to implement this with the facade design pattern.

生活的游戏是一个有趣的0玩家游戏,其中定义了宇宙,并以死亡和活着的细胞模式开始。那么这个宇宙的演变是通过反复应用一些规则来观察的。请查看维基链接的详细信息。

Game of life is an interesting 0 player game where a universe is defined and started off with a pattern of dead and alive cells. Then the evolution of this universe is observed by repeatedly applying some rules. Please check the wiki link for extensive info.

我创建了两个课程:


  1. 宇宙类。这个类保持了整个宇宙状态的标签。哪些细胞是死的,哪些细胞是活的。这是我的控制类。

  2. 细胞类:这个类将生命游戏的规则适用于自己,并决定其状态。

我的问题:


  1. 被我认为是外观图案?

  2. 正面图案是这个问题的正确选择吗?


推荐答案

阅读Holub on Patterns。他专门讨论了GoL和使用设计模式。请注意,您的老师也可能已经阅读了,所以如果你去这条路线,你会被期望为他的工作添加一些原始的想法和工作。

Read "Holub on Patterns". He specifically discusses GoL and use of design patterns. Be aware that your teacher may have read it too, so if you go this route you will be expected to add some original thought and work to his work.

这篇关于生活的游戏与门面设计模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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