Comments (6)
AI不需要随机性
仅仅从游戏性来说,AI是不太需要这种随机性的东西。禁用Math.random
之后胜负就能确定。(输的心服口服)
在有高级一点算法的辅助下是可以不需要这个函数的
去掉也挺纠结
这是因为不是每个人都能考虑每种情况去执行命令。在前期需要Math.random
让代码能跑起来。
而且完全脱离Math.random
可能需要自己写比较高级的函数辅助。
可以先不禁止Math.random
,但是给大家说明一下
(有可能的话,在编辑器中出现Math.random
就提醒)
可以给一周的延缓期,并且声明一周后使用Math.random
会造成代码出错
from codegame.
如果是为了包整结果的为一性,我觉得可以将Math.random的随机数种子设值为和账号相关的值(例如用户明,用户id)
这样的话,每个人就都会用有一个独特而又固定的随机序列
这样大家既可以用Math.random,又可以让对站结果固定
from codegame.
有些地方确实要random。比如没有星星,没有敌方,前方有石头,这时候往左拐还是右呢?
from codegame.
实例文档给的就是用的random,http://codegame.org/doc/api 。所以用的人多。
from codegame.
把方案调整为 @SakuraSa 说的那样,以代码的 md5 为随机种子如何。这样对同一份代码来说 Math.random 返回的值依然是完全随机的,不过重复运行代码时生成的随机数是相同的。
from codegame.
@luin 同意!就这么改吧,只要Math.random的结果是固定的就挺好的。
from codegame.
Related Issues (20)
- 同样的代码主场运行速度比客场快 HOT 1
- 地图有BUG 死亡草原坐标 x:3 y:1 应该标识为o 结果为x HOT 2
- 是不是AI运行时间的计算有什么问题呢? HOT 3
- [建议]增加游戏帧数上限,提升游戏乐趣 HOT 2
- 增加快捷键
- 增加单步调试功能 HOT 3
- 不知道为什么Bug了 HOT 2
- 坦克头朝下的时候,打印出来的方向居然是dowm,单词拼写错误 HOT 2
- 排行榜序号 HOT 7
- 草丛中移动一格需要两帧 HOT 3
- 排行榜似乎不更新了 HOT 1
- 【建议】增加倒车功能
- 如何在本地运行 HOT 9
- 建议引入等级分制度 HOT 2
- 这算bug吗? HOT 2
- npm run build出错
- 预览出错
- http://127.0.0.1:3000/account/github/callback访问出错
- npm run build 出错
- 有数据库sql吗 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codegame.