day5part2_curses.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:adventofcode2016 作者: natemago 项目源码 文件源码
def print_random_chars(scr, lock, n, tx, ty, sx, sy, sw, sh):
  lock.acquire()
  try:

    for i in range(0, n):
      x = randint(1, tx-2)
      y = randint(1, ty-2)
      if (x > sx and x < (sx + sw) )\
         and (y > sy and y < (sy + sh)):
        continue
      color = randint(100, 199)
      c = '%x' % randint(0, 15)
      if randint(0,100) % 2 == 0:
        c = ' '
      scr.addstr(y, x, c, color_pair(color))
    scr.refresh()
  finally:
    lock.release()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号