Exemplo n.º 1
0
 def blur_image(self):
     val, ok = QInputDialog.getInt(
         self,
         _('Blur image'),
         _('The standard deviation for the Gaussian blur operation (higher means more blurring)'
           ),
         value=3,
         min=1,
         max=20)
     if ok:
         self.canvas.blur_image(sigma=val)
Exemplo n.º 2
0
 def sharpen_image(self):
     val, ok = QInputDialog.getInt(
         self,
         _('Sharpen image'),
         _('The standard deviation for the Gaussian sharpen operation (higher means more sharpening)'
           ),
         value=3,
         min=1,
         max=20)
     if ok:
         self.canvas.sharpen_image(sigma=val)
Exemplo n.º 3
0
    def init_logic(self):
        logger.info(f"初始化逻辑数据")

        self.loop_index = 1
        self.invalid_cell_count = 0

        # 先手为蓝
        self.step_cell = cell_blue

        # ai托管,默认不托管
        self.ai_cells = {}
        self.ai_to_avg_stat = {}  # type: Dict[int, AvgStat]

        self.ai_moving = False

        self.game_start_time = datetime.now()
        self.game_restarted = False

        self.ai_dfs_max_depth = 4
        self.ai_min_decision_seconds = 0.5
        self.ai_max_decision_time = timedelta(seconds=26)
        blue_set_ai = True
        red_set_ai = True

        self.ai_dfs_max_depth, _ = QInputDialog.getInt(self, "ai参数设置", f"ai最大搜索层数(越大越强,速度越慢,默认为{self.ai_dfs_max_depth})", self.ai_dfs_max_depth)
        self.ai_min_decision_seconds, _ = QInputDialog.getDouble(self, "ai参数设置", f"ai每步最小等待时间(秒)(太小可能会看不清手动方的落子位置-。-)", self.ai_min_decision_seconds)
        ai_max_decision_time, _ = QInputDialog.getDouble(self, "ai参数设置", f"ai每步最大等待时间(秒)(避免超出30秒)", self.ai_max_decision_time.total_seconds())
        self.ai_max_decision_time = timedelta(seconds=ai_max_decision_time)
        blue_set_ai = QMessageBox.question(self, "AI配置", "蓝方是否启用AI?") == QMessageBox.Yes
        red_set_ai = QMessageBox.question(self, "AI配置", "红方是否启用AI?") == QMessageBox.Yes

        if blue_set_ai:
            self.set_ai(cell_blue, self.ai_min_max)
        if red_set_ai:
            self.set_ai(cell_red, self.ai_min_max)

        logger.info(f"ai最大迭代次数为{self.ai_dfs_max_depth},每次操作至少{self.ai_min_decision_seconds}秒,最大等待时间为{self.ai_max_decision_time}秒")

        self.last_step = (1, 1)

        self.init_board_without_invalid_cells()
Exemplo n.º 4
0
 def blur_image(self):
     val, ok = QInputDialog.getInt(self, _('Blur image'), _(
         'The standard deviation for the Gaussian blur operation (higher means more blurring)'), value=3, min=1, max=20)
     if ok:
         self.canvas.blur_image(sigma=val)
Exemplo n.º 5
0
 def sharpen_image(self):
     val, ok = QInputDialog.getInt(self, _('Sharpen image'), _(
         'The standard deviation for the Gaussian sharpen operation (higher means more sharpening)'), value=3, min=1, max=20)
     if ok:
         self.canvas.sharpen_image(sigma=val)