# What it is about
With this program, Cozmo will try to guess the number you are thinking about (by default the search range is [0,60]). Without further ado, here is a video showing how it works (**please enable the subtitles in the video for more info**):
https://www.youtube.com/watch?v=Oj2uBXrqvrE
In the video, Cozmo makes guesses in French but the program should work fine for any language implemented in your Cozmo.
This idea came to me after seeing [this post](https://forums.anki.com/t/number-guessing-game/10846), so thank you @Cadwallader01 for the idea!
In the post above, the user is supposed to guess a number picked by Cozmo. But I think the other way around is also pretty interesting. That's why I imagined this simple algorithm to implement this functionality.
# How it works
When starting the program, you will be asked to sequentially tap on each cube when their respective lights go up (it's required for the event handling, at least in the way I implemented it). You can then specify a new range for the search by typing the 2 limit values (`lower higher`) of the new range, separated by a space. It will be checked wether the input is valid or not and the range will be asked again if an error is detected. Any range is possible, you could select `-3000 5000` as your custom range if you want!
On the other hand, if you want to use the default range, just press `Enter` without specifying anything and the program will further execute.
To make Cozmo guess what your secret number is, you can only tell him if your number is greater or smaller than its guess. To do so, you can tap on each cube with the according color:
- blue: your number is smaller
- green: that's it! Cozmo guessed right
- red: your number is greater
When Cozmo finally finds your number, he plays a few animations celebrating and the game is over.
While playing, Cozmo will look for faces and will turn towards one if a face appears. If no face is detected, Cozmo will make a guess anyway.
If you mess things up and give weird answers, Cozmo will eventually be aware of it and will quit the game, kind of frustrated.
If you don't give any answer quickly enough (after 30 seconds), Cozmo will show that it got bored and will exit the game.
At the end of each game, you can press `Enter` to restart a new game or leave by pressing any key followed by `Enter`.
# The code!
[guess_number.py](https://github.com/LucasWaelti/Cozmo/blob/master/guess_number/guess_number.py) and
[guess_number_anim.py](https://github.com/LucasWaelti/Cozmo/blob/master/guess_number/guess_number_anim.py)
## Remarks
I have tested the code a few times now and it should be robust enough. So if you decide to try it out, hopefully it will work just fine!
### Requirements
All you need is to download or copy both files `guess_number_anim.py` and `guess_number.py`, run this last one and start playing. You will need the `numpy` module to be installed.
### Advice
Simply be careful when starting the program, information will be displayed in the command prompt to help you setup the game. So if nothing is happening with Cozmo and its cubes, you might be expected to give an input from the keyboard to continue. Once the game is launched, you do not need to care about the command prompt while playing, although the guesses that Cozmo makes are also displayed on the screen in case the audio wasn't too good.
### Feedback
I would really appreciate hearing back from those who try this little game. Any remark, suggestion or bug report would be appreciated!
没有合适的资源?快使用搜索试试~ 我知道了~
Cozmo:Anki公司有关控制机器人Cozmo的软件的存储库
共9个文件
py:5个
md:4个
需积分: 9 2 下载量 154 浏览量
2021-05-12
00:28:58
上传
评论 1
收藏 21KB ZIP 举报
温馨提示
Cozmo-软件 Anki公司有关控制机器人Cozmo的软件的存储库 这是一个小游戏,其中Cozmo会猜测用户选择的秘密号码。 该程序使Cozmo可以在收集多维数据集后自行停靠在充电器上,而无需任何其他帮助或特殊标记。 这个小工具允许Cozmo使用背包灯,像水平仪一样帮助您搭建家具。
资源详情
资源评论
资源推荐
收起资源包目录
Cozmo-master.zip (9个子文件)
Cozmo-master
level
README.md 818B
level.py 3KB
README.md 657B
guess_number
guess_number_anim.py 7KB
README.md 4KB
guess_number.py 5KB
self_docking
self_docking.py 19KB
self_docking_v2.py 22KB
README.md 2KB
共 9 条
- 1
ShiMax
- 粉丝: 51
- 资源: 4424
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Python大作业:音乐播放软件(爬虫+可视化+数据分析+数据库)
- 课程设计-python爬虫-爬取日报,爬取日报文章后存储到本地,附带源代码+课程设计报告
- 软件和信息技术服务行业投资与前景预测.pptx
- 课程设计-基于SpringBoot + Mybatis+python爬虫NBA球员数据爬取可视化+源代码+文档+sql+效果图
- 软件品质管理系列二项目策划规范.doc
- 基于TensorFlow+PyQt+GUI的酒店评论情感分析,支持分析本地数据文件和网络爬取数据分析+源代码+文档说明+安装教程
- 软件定义无线电中的模拟电路测试技术.pptx
- 软件开发协议(作为技术开发合同附件).doc
- 软件开发和咨询行业技术趋势分析.pptx
- 软件测试题详解及答案.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0