首页 开发技术 其它     /    ttt-5-move-rb-q-000-源码

ttt-5-move-rb-q-000-源码

上传者: weixin_42107491 | 上传时间:2024/6/5 21:41:46 | 文件大小:10KB | 文件类型:ZIP
ttt-5-move-rb-q-000-源码
TicTacToeCLI:在游戏板上添加玩家移动目标定义一种将用户输入转换为数组索引的方法。
定义更新传递给它的数组的方法。
用默认值定义一个方法。
在CLI中使用方法。
通过获取接受用户输入。
在方法中使用用户输入。
概述在本实验中,我们将在TicTacToe中添加一个input_to_index方法和一个move方法,以使用玩家的令牌更新棋盘。
input_to_index方法将获取用户的输入(“1”-“9”)并将其转换为板阵列的索引(0-8)。
move方法表示用户移动到井字游戏中的某个位置(例如中间单元)。
我们已经有一个方法#display_board,它将井字游戏板输出到控制台,并将该板的每个位置映射到一个数组索引。
然后,我们将构建一个CLI,该CLI要求玩家输入他们喜欢用“X”或“O”填写的棋盘上的位置,将该位置转换为索引,更新棋盘,并显

文件下载

资源详情

[{"title":"(14个子文件10KB)ttt-5-move-rb-q-000-源码","children":[{"title":"ttt-5-move-rb-q-000-master","children":[{"title":"bin","children":[{"title":"move <span style='color:#111;'>76B</span>","children":null,"spread":false}],"spread":true},{"title":"CONTRIBUTING.md <span style='color:#111;'>1.77KB</span>","children":null,"spread":false},{"title":"Gemfile <span style='color:#111;'>86B</span>","children":null,"spread":false},{"title":"Gemfile.lock <span style='color:#111;'>626B</span>","children":null,"spread":false},{"title":".rspec <span style='color:#111;'>64B</span>","children":null,"spread":false},{"title":"spec","children":[{"title":"01_input_to_index_spec.rb <span style='color:#111;'>576B</span>","children":null,"spread":false},{"title":"03_cli_spec.rb <span style='color:#111;'>2.24KB</span>","children":null,"spread":false},{"title":"02_move_spec.rb <span style='color:#111;'>2.07KB</span>","children":null,"spread":false},{"title":"spec_helper.rb <span style='color:#111;'>546B</span>","children":null,"spread":false}],"spread":true},{"title":"LICENSE.md <span style='color:#111;'>1.32KB</span>","children":null,"spread":false},{"title":".gitignore <span style='color:#111;'>642B</span>","children":null,"spread":false},{"title":".learn <span style='color:#111;'>52B</span>","children":null,"spread":false},{"title":"lib","children":[{"title":"move.rb <span style='color:#111;'>274B</span>","children":null,"spread":false}],"spread":true},{"title":"README.md <span style='color:#111;'>7.60KB</span>","children":null,"spread":false}],"spread":false}],"spread":true}]

评论信息

免责申明

【好快吧下载】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【好快吧下载】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【好快吧下载】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,8686821#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明