在 Spring 应用程序中维护状态?
只是寻找一些有关在 Spring 应用程序中维护某些内容的状态的理论。
例如,想象一下作为 Web 应用程序运行的扑克游戏。有很多事情需要考虑。例如维护玩家一手牌中的筹码数量、参与一手牌的人、每个玩家的牌值以及共享的公共牌。下注金额、底池总额等。
其他需要考虑的因素是玩家在被弃牌之前必须采取行动的时间分配。
无论执行游戏循环的逻辑如何,使用 spring 跟踪一手扑克以及完整的扑克游戏状态的最佳方法是什么。
提前致谢。
Just looking for a bit if theory regarding maintaining state of something in a spring application.
For example imagine a game of poker running as a web app. There are a number of things to consider. Such as maintaining the amount of poker chips a player has in a hand, who is involved in a hand, the card values per player as well as the shared community cards. The amounts bet, pot totals etc.
Other things to consider are the time allocations a player has to act before being folded.
Regardless of the logic for performing the game loop, what would be the best way to keep track of the state of a hand of poker and also a complete game of poker using spring.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与跟踪网络应用程序中的任何数据的方式相同;编写一个 DAO 接口,然后创建一个实现。例如;
每当玩家采取更改操作时,他们都会向网络应用程序发出请求。您将必须跟踪几件事的状态,并且显然您将不得不担心玩家之间的状态同步。
Same way as you keep track of any data in a web app; write a DAO interface then create an implementation. For example;
Whenever a player takes an action to change they make a request to the web app. You're going to have to keep track of the state of several things, and you're obviously going to have to worry about syncronising the state amongst players.