这是正确的方法吗?

发布于 2025-01-07 21:24:59 字数 181 浏览 2 评论 0原文

你好,我必须为“Game of Life”游戏编写java代码。细胞的数量必须是无限的。 方法正确吗?我的意思是设计方面它们紧密耦合吗?

Class Universe
{
  Cell cells[];
}
 Class cell
{
  boolean live;
}

Hi i have to write java code for the "Game of Life" game. The number of cells must be infinite.
Is the approach correct? I mean Design wise are they tightly coupled?

Class Universe
{
  Cell cells[];
}
 Class cell
{
  boolean live;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

复古式 2025-01-14 21:24:59

如果您想要“无限”数量的单元格,请使用某种类型的可扩展列表(ArrayList、LinkedList 等)。
但是,您只能分配计算机内存允许的尽可能多的单元格。
不太清楚紧密/松散耦合是什么意思......解释一下?

If you want an "infinite" amount of cells, then use some type of expandable list (ArrayList, LinkedList, etc).
However, you'll only be able to allocate as many cells as your computer memory will allow.
Don't really know what you mean by tightly/loosely coupled... explain?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文