Card-Forge / Card-Forge/forge

A way to script puzzles

Open
#11,643 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.7k
Forks
1.1k
Avg merge
1d 1h
Merged PRs (30d)
163

Description

**Is your feature request related to a problem? Please describe.**
Puzzles often assume the opponent will play perfectly, however the AI will often mess up simple steps that enable an unforseen solution. E.g. PS_AFR1.pzl can be solved by cheating in Old Gnawbone which on Default AI personality won't get blocked, creates lots of treasures and trivializes dealing 20 damage.

**Describe the solution you'd like**
I imagine a set of instructions that can be included in the .pzl file to force the AI to
-block certain creatures
-attack/block with certain creatures
-keep up spells until prerequisites like (number of) cards (not) in hand/on the stack/in the graveyard/on the battlefield are fulfilled and
-target specific permanents or spells with spells or abilities,
if possible turn by turn. This can either support AI decisions or completely dictate the AIs actions.
This would ideally be similar to a simple scripting language like python, bash or batch.

**Describe alternatives you've considered**
At least a way to define which AI gets used in a given puzzle and a puzzle AI should be possible, which considers the number of turns remaining and blocks/attacks more aggressively.

**Additional context**
Here is a simple example:
[metadata]
Name:Example
Goal:Win
Turns:5
Difficulty:Common
Description:Win.
personality=aggressive

[state]
humanlife=2
ailife=5
activeplayer=human
activephase=MAIN1
humanhand=Colossal Dreadmaw;Lightning Bolt
humanlibrary=Forest;Forest
humanbattlefield=Forest;Forest;Forest;Forest;Forest;Taiga
aihand=Counterspell;Bloodghast
ailibrary=Swamp
aibattlefield=Bog Imp;Underground Sea;Underground Sea

[script]
keep 'Counterspell' for 'Colossal Dreadmaw'
T2(
M1(play 'Bloodghast')
DA(
if aibattlefield contains 'Bog Imp':(
attack 'Bog Imp'
noattack 'Bloodghast')
)
noplay 'Swamp'
)
This would cause the AI to hold counterspells for a dreadmaw and perform other atypical actions like keeping the land in hand for the turn. Not forcing illegal actions would fall upon the puzzle's creator if they cannot simply be ignored.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how .pzl files are parsed and how puzzle turns are handed to the AI decision logic. Define the scope and syntax for the proposed [script] section, including legal action handling and state prerequisites; done means a puzzle can reliably direct or constrain the AI across turns with coverage for the example behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
ai, game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.