Implementation:Open compass VLMEvalKit VGRPBench StarBattle
| Field | Value |
|---|---|
| source | VLMEvalKit |
| domain | Vision, Evaluation, Puzzle_Solving |
Overview
Implements constraint checking and puzzle factory for the Star Battle region-based placement puzzle in VGRPBench.
Description
This module defines constraint validators and a puzzle factory for the Star Battle puzzle type, where exactly one star must be placed in each row, column, and region with no two stars adjacent (including diagonally). The ConstraintRowStar and ConstraintColStar classes enforce exactly one star per completed row and column. The ConstraintRegionStar class validates star counts within defined regions. The ConstraintAdjacentStar class prevents stars from being placed in any of the eight surrounding cells. The StarBattlePuzzleFactory accepts a configurable number of stars per region.
Usage
Called internally by VGRPBench evaluation pipeline for puzzle constraint verification.
Code Reference
- Source:
vlmeval/dataset/utils/vgrpbench/puzzles/starbattle.py, Lines: L1-130 - Import:
from vlmeval.dataset.utils.vgrpbench.puzzles.starbattle import StarBattlePuzzleFactory
Key Classes:
class ConstraintRowStar(Constraint): ...
class ConstraintColStar(Constraint): ...
class ConstraintRegionStar(Constraint): ...
class ConstraintAdjacentStar(Constraint): ...
class StarBattlePuzzleFactory(PuzzleFactory): ...
I/O Contract
| Direction | Description |
|---|---|
| Inputs | Puzzle grid state with board containing 's' (star) or 'e' (empty) values and regions matrix |
| Outputs | Boolean validation result or constraint violations |
Usage Examples
# Internal usage
from vlmeval.dataset.utils.vgrpbench.puzzles.starbattle import StarBattlePuzzleFactory
factory = StarBattlePuzzleFactory(size=5, num_stars=1)
result = factory.check(game_state)