当前位置: 首页 > news >正文

python中loop函数_为何GAMLOOP中函数输出的Python Scopage不计算?

在调用函数之后,即使函数的计算值为false,将这个false值赋给gamePlaying但,gamePlaying条件仍然计算为true并继续进行。def check_win(): #function checks for three in a row across, down, and diagonals

for x in range (0, 3) :

y = x*3

if (board[y] == board[(y + 1)] and board[y] == board[(y + 2)]):

gamePlaying = False

else:

gamePlaying = True

if (board[x] == board[(x + 3)] and board[x] == board[(x + 6)]):

gamePlaying = False

else:

gamePlaying = True

if((board[0] == board[4] and board[0] == board[8]) or

(board[2] == board[4] and board[4] == board[6])):

gamePlaying = False

else:

gamePlaying = True

return(gamePlaying)

currentPlayer = [first_player,second_player] #creates list to iterate over turns

gamePlaying = True #bool for gameloop

while gamePlaying: #main game loop

for i in currentPlayer: #iterates over current player to switch turns

draw_board()

place_move = int(input(first_move + ' what is your move? ')) #inputs then places move for first_player

board[place_move] = first_player

gamePlaying = check_win() #should take bool output of check_win and store to cont or end gameloop

draw_board()

place_move = int(input(second_move + ' what is your move? ')) #inputs then places move for second_player

board[place_move] = second_player

gamePlaying = Check_win() #should take bool output of check_win and store to cont or end gameloop

相关文章:

  • springboot 源码_SpringBoot是如何实现自动配置的? SpringBoot源码(四)
  • etw系统provider事件较多_使用Spring Gateway和KeyCloak构建一个OIDC认证系统
  • @data注解_一枚 架构师 也不会用的Lombok注解,相见恨晚
  • java中int和integer的区别_Java中关于强、软、弱、虚引用的区别
  • android 投屏_[Android] 虫洞手机投屏电脑(支持键盘映射和传声音)
  • 云丁智能锁说明书_真硬核!行业爆发前夜,这把锁登上航母
  • python调用node_node-python:在nodejs中调用python代码
  • python多线程读取文件内容_python多线程读取logcat内容,导致其他线程阻塞
  • python闭包满足的三个条件_Python中的闭包
  • javascript等待异步线程完成_程序员修神之路--问世间异步为何物?
  • python取随机数画图_python3测试工具开发快速入门教程1turtle绘图-4选择与随机数...
  • python中如何输入多行字符_python中怎么输入多行字符串
  • python饼图显示百分比_解决echarts饼图显示百分比,和显示内容字体及大小
  • java 二维数组定义长方体_47.二维数组的定义
  • zap 自定义日志格式_Go 每日一库之 zap
  • 《Javascript高级程序设计 (第三版)》第五章 引用类型
  • 08.Android之View事件问题
  • 2018天猫双11|这就是阿里云!不止有新技术,更有温暖的社会力量
  • 4月23日世界读书日 网络营销论坛推荐《正在爆发的营销革命》
  • Apache Spark Streaming 使用实例
  • CEF与代理
  • Hexo+码云+git快速搭建免费的静态Blog
  • JavaScript设计模式与开发实践系列之策略模式
  • JSDuck 与 AngularJS 融合技巧
  • JWT究竟是什么呢?
  • Netty源码解析1-Buffer
  • niucms就是以城市为分割单位,在上面 小区/乡村/同城论坛+58+团购
  • PHP的类修饰符与访问修饰符
  • python 装饰器(一)
  • Quartz初级教程
  • scala基础语法(二)
  • Vue小说阅读器(仿追书神器)
  • 复杂数据处理
  • 给Prometheus造假数据的方法
  • 力扣(LeetCode)22
  • 微信公众号开发小记——5.python微信红包
  • 我这样减少了26.5M Java内存!
  • 一个普通的 5 年iOS开发者的自我总结,以及5年开发经历和感想!
  • 你学不懂C语言,是因为不懂编写C程序的7个步骤 ...
  • ​LeetCode解法汇总2808. 使循环数组所有元素相等的最少秒数
  • !!java web学习笔记(一到五)
  • #pragma预处理命令
  • #我与Java虚拟机的故事#连载09:面试大厂逃不过的JVM
  • (附源码)计算机毕业设计SSM智慧停车系统
  • (论文阅读11/100)Fast R-CNN
  • (十)DDRC架构组成、效率Efficiency及功能实现
  • (原創) 物件導向與老子思想 (OO)
  • (转载)Linux 多线程条件变量同步
  • .bat批处理(四):路径相关%cd%和%~dp0的区别
  • .Family_物联网
  • .gitignore文件—git忽略文件
  • .NET Compact Framework 多线程环境下的UI异步刷新
  • .NET Core WebAPI中封装Swagger配置
  • .NET Core 和 .NET Framework 中的 MEF2
  • .net 打包工具_pyinstaller打包的exe太大?你需要站在巨人的肩膀上-VC++才是王道