是否可以以不使用运算顺序的方式编写 (a*b)+(c*d) ?
好吧,warsow 有一些非常优秀的 HUD 代码,除了数学逻辑有点奇怪。
输入:
a*b + c*d
解释为:
((d*c) + b) * a
如您所见,游戏以相反的顺序执行一系列操作,而不考虑操作顺序。括号在 hud 代码中不起作用。它必须是一系列线性操作才能得出最终结果。这可能吗? 我知道最好在 HUD 代码中实现正确的数学运算,但在我看来,这更有趣。
Alright, so warsow has some pretty excellent hud code with the exception that the math logic is a bit screwy.
Input:
a*b + c*d
Interpreted as:
((d*c) + b) * a
As you can see, the game does a series of operations in reverse order without regard to order of operations. Parentheses do not work in the hud code. It must be a linear series of operations to come up with the end result. Is this possible?
I understand that it would be better to implement proper math into the hud code, but this is way more fun imo.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
授予正规代数成立
granted normal algebra holds