python - 为什么我的列表取另一个列表的值?
问题描述
这是我的代码:
def countCase(y, x, brd):
if x < len(brd[1])-1 and y < len(brd)-1:
if brd[y][x] == '-':
count = 1
brd[y] = brd[y][:x]+'x'+brd[y][x+1:]
count += countCase(y+1, x, brd)
count += countCase(y-1, x, brd)
count += countCase(y, x+1, brd)
count += countCase(y, x-1, brd)
return count
return 0
dirval[0] = countCase(pos['y']-1, pos['x'], board)
dirval[1] = countCase(pos['y']+1, pos['x'], board)
dirval[2] = countCase(pos['y'], pos['x']-1, board)
dirval[3] = countCase(pos['y'], pos['x']+1, board)
我的问题是:
- 我不知道为什么,但给函数的变量“board”取了“brd”变量的值
谢谢你的帮助。
解决方案
推荐阅读
- javascript - 使用 AJAX 调用 php 文件
- pact - PACT Bamboo 测试结果解析器
- angular - 如何使用 RxJS 处理 Angular 服务中的多个 api 调用?
- c# - .getJSON 响应没有发生
- javascript - 缩短 Charts.js 中的数字标签
- jquery - 使用 jquery 选择动态创建的元素
- c++ - CLion Boost 库
- python - 在 python 2.7.15 中有条件地替换行尾
- sql - 是否可以只使用带有子查询的“SELECT”子句而不使用“FROM”子句?
- .htaccess - 如何使用 htaccess 将变量添加到现有 url