RepairPitchingGame.py 文件源码

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

项目:POTCO-PS 作者: ksmit799 项目源码 文件源码
def placeLeak(self, leak):
        tooClose = True
        attempts = 0
        while tooClose and attempts < self._MAX_TRIES:
            attempts += 1
            locator = self.locators[random.randint(0, len(self.locators) - 1)]
            relative = self.getRelativePoint(self.board, Point3(locator.getX(), 0, locator.getZ()))
            x = relative.getX()
            z = relative.getZ()
            tooClose = False
            for otherLeak in self.activeLeaks:
                dist = math.hypot(otherLeak.getX() - x, otherLeak.getZ() - z)
                if dist < self._MIN_DIST:
                    tooClose = True
                    continue

            for otherLeak in self.patchedLeaks:
                dist = math.hypot(otherLeak.getX() - x, otherLeak.getZ() - z)
                if dist < self._MIN_DIST:
                    tooClose = True
                    continue

        leak.repositionTo(x, z)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号