Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Open compass VLMEvalKit VGRPBench Battleships

From Leeroopedia
Field Value
source VLMEvalKit
domain Vision, Evaluation, Puzzle_Solving

Overview

Implements constraint checking and puzzle factory for the Battleships grid puzzle in VGRPBench.

Description

This module defines constraint validators and a puzzle factory for the Battleships puzzle type. The ConstraintBattleships class ensures ships do not touch each other diagonally, handling both revealed ship cells with directional metadata and regular ship cells. The ConstraintBattleshipsHints class validates row and column ship counts against hint values, verifies total ship cell counts, and when the board is fully defined, performs connected-component analysis to verify that ship shapes match the required fleet configuration.

Usage

Called internally by VGRPBench evaluation pipeline for puzzle constraint verification.

Code Reference

  • Source: vlmeval/dataset/utils/vgrpbench/puzzles/battleships.py, Lines: L1-160
  • Import: from vlmeval.dataset.utils.vgrpbench.puzzles.battleships import BattleshipsPuzzleFactory

Key Classes:

class ConstraintBattleships(Constraint): ...
class ConstraintBattleshipsHints(Constraint): ...
class BattleshipsPuzzleFactory(PuzzleFactory): ...

I/O Contract

Direction Description
Inputs Puzzle grid state with board, row/column hints, and ships configuration
Outputs Boolean validation result or constraint violations

Usage Examples

# Internal usage
from vlmeval.dataset.utils.vgrpbench.puzzles.battleships import BattleshipsPuzzleFactory
factory = BattleshipsPuzzleFactory(size=8)
result = factory.check(game_state)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment