Implementation:Open compass VLMEvalKit VGRPBench Battleships
| 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)