실용적인 ChessLang 변형 예제

ChessLang 예제

ChessLang으로 만들 수 있는 다양한 체스 변형 예제입니다.

기본 변형 (레벨 1)

💡 조건 결합 규칙: 여러 승리 조건은 OR로 결합됩니다. add로 추가된 조건 중 하나라도 만족하면 게임이 종료됩니다.

King of the Hill

중앙을 장악하면 승리합니다.

chesslang
game: "King of the Hill"
extends: "Standard Chess"

board:
  zones:
    hill: [d4, d5, e4, e5]

# OR 결합: checkmate OR hill
# 체크메이트 또는 킹이 중앙에 도달하면 승리
victory:
  add:
    hill: King in zone.hill

Three-Check

3회 체크하면 승리합니다.

chesslang
game: "Three-Check"
extends: "Standard Chess"

# OR 결합: checkmate OR three_checks
# 체크메이트 또는 3회 체크로 승리
victory:
  add:
    three_checks: checks >= 3

Racing Kings

체크 없이 8랭크에 먼저 도달하면 승리합니다.

chesslang
game: "Racing Kings"
extends: "Standard Chess"

setup:
  White:
    King: [a1]
    Queen: [b1]
    Rook: [c1, d1]
    Bishop: [e1, f1]
    Knight: [g1, h1]
  Black:
    King: [a2]
    Queen: [b2]
    Rook: [c2, d2]
    Bishop: [e2, f2]
    Knight: [g2, h2]

# replace: checkmate 조건을 racing으로 교체
# 결과: racing 조건만 적용 (체크메이트 무효)
victory:
  replace:
    checkmate: King on rank 8

rules:
  check:
    cannot_give: true

Horde Chess

백은 폰 대군, 흑은 표준 세트입니다.

chesslang
game: "Horde Chess"
extends: "Standard Chess"

setup:
  White:
    Pawn: [a1, b1, c1, d1, e1, f1, g1, h1,
           a2, b2, c2, d2, e2, f2, g2, h2,
           a3, b3, c3, d3, e3, f3, g3, h3,
           a4, b4, c4, d4, e4, f4, g4, h4,
           f5, g5]
  Black:
    King: [e8]
    Queen: [d8]
    Rook: [a8, h8]
    Bishop: [c8, f8]
    Knight: [b8, g8]
    Pawn: [a7, b7, c7, d7, e7, f7, g7, h7]

# 비대칭 승리 조건
# 백: 모든 흑 기물 제거시 승리
# 흑: 체크메이트로 승리
victory:
  remove:
    - checkmate              # 기본 체크메이트 제거
  add:
    white_wins: opponent.pieces == 0    # 백 승리 조건
    black_wins: checkmate               # 흑 승리 조건

커스텀 기물 (레벨 2)

Amazon (아마존)

퀸과 나이트의 조합입니다.

chesslang
game: "Amazon Chess"
extends: "Standard Chess"

piece Amazon {
  move: slide(orthogonal) | slide(diagonal) | leap(2, 1)
  capture: =move
  value: 12
}

setup:
  replace:
    White:
      Queen: []
      Amazon: [d1]
    Black:
      Queen: []
      Amazon: [d8]

Chancellor (챈슬러)

룩과 나이트의 조합입니다.

chesslang
piece Chancellor {
  move: slide(orthogonal) | leap(2, 1)
  capture: =move
  value: 9
}

Archbishop (대주교)

비숍과 나이트의 조합입니다.

chesslang
piece Archbishop {
  move: slide(diagonal) | leap(2, 1)
  capture: =move
  value: 8
}

Cannon (포)

중국 장기의 포처럼 잡기 위해 기물을 뛰어넘어야 합니다.

chesslang
piece Cannon {
  move: slide(orthogonal)
  capture: hop(orthogonal)
  value: 5
}

고급 커스텀 기물

복잡한 동작과 상태를 가진 고급 기물들입니다.

Berserker (광전사)

적을 잡을 때마다 분노가 쌓입니다.

chesslang
game: "Berserker Chess"
extends: "Standard Chess"

piece Berserker {
  move: step(any)
  capture: =move
  state: { rage: 0 }
  value: 5
}

# 적을 잡을 때마다 분노 증가
trigger rage_buildup {
  on: capture
  when: piece.type == Berserker
  do: set piece.state.rage = piece.state.rage + 1
}

setup:
  add:
    White Berserker: [c1]
    Black Berserker: [f8]

Cooldown Knight (쿨다운 나이트)

나이트가 이동 후 1턴 동안 쿨다운에 들어갑니다.

chesslang
game: "Cooldown Knight Chess"
extends: "Standard Chess"

piece CooldownKnight {
  move: leap(2, 1)
  capture: =move
  traits: [jump]
  state: { cooldown: 0 }
  value: 3
}

# 이동 후 쿨다운 설정
trigger knight_cooldown {
  on: move
  when: piece.type == CooldownKnight
  do: set piece.state.cooldown = 2
}

# 턴마다 쿨다운 감소
trigger reduce_cooldown {
  on: turn_end
  do: {
    for p in pieces: {
      if p.state.cooldown > 0: {
        set p.state.cooldown = p.state.cooldown - 1
      }
    }
  }
}

setup:
  replace:
    Knight: CooldownKnight

Zombie Chess (좀비 체스)

폰이 잡히면 적 좀비로 부활합니다. 좀비는 부활하지 않습니다.

chesslang
game: "Zombie Chess"
extends: "Standard Chess"

piece Zombie {
  move: step(any)
  capture: =move
  traits: [undead]
  state: { resurrected: true }
  value: 2
}

# 폰이 잡히면 잡는 기물의 원래 위치에 적 좀비로 부활
# 좀비(Zombie)는 Pawn이 아니므로 이 트리거에 해당하지 않음
trigger pawn_rises {
  on: capture
  when: captured.type == Pawn
  do: create Zombie at origin for captured.owner
}

Shield Effect (방어막 효과)

특정 칸에 방어막을 설치하여 적 이동을 차단합니다.

chesslang
game: "Shield Chess"
extends: "Standard Chess"

effect shield {
  blocks: enemy
  visual: "blue"
}

piece Shielder {
  move: step(any)
  capture: =move
  state: { shields: 0 }
  value: 4
}

trigger place_shield {
  on: move
  when: piece.type == Shielder and piece.state.shields < 2
  optional: true
  description: "방어막을 설치하시겠습니까?"
  do: {
    mark origin with shield
    set piece.state.shields = piece.state.shields + 1
  }
}

setup:
  add:
    White Shielder: [d2]
    Black Shielder: [d7]

Power Warrior (파워 전사)

적을 잡을 때마다 킬 카운트가 증가합니다.

chesslang
game: "Power Warrior Chess"
extends: "Standard Chess"

piece Warrior {
  move: step(any)
  capture: =move
  state: { kills: 0 }
  value: 4
}

trigger count_kills {
  on: capture
  when: piece.type == Warrior
  do: set piece.state.kills = piece.state.kills + 1
}

setup:
  add:
    White Warrior: [d2, e2]
    Black Warrior: [d7, e7]

Jump Bishop (점프 비숍)

장애물을 뛰어넘을 수 있는 비숍입니다.

chesslang
game: "Jump Bishop Chess"
extends: "Standard Chess"

piece JumpBishop {
  move: slide(diagonal)
  capture: =move
  traits: [phase]      # 기물을 통과할 수 있음
  value: 4
}

setup:
  replace:
    Bishop: JumpBishop

효과와 트리거

Atomic Chess

잡기가 폭발을 일으켜 인접 기물을 모두 제거합니다. 폰은 폭발에서 제외됩니다.

chesslang
game: "Atomic Chess"
extends: "Standard Chess"

# 잡기 발생 시 폭발 - 반경 1 내 모든 기물 제거 (폰 제외)
trigger atomic_explosion {
  on: capture
  do: {
    remove pieces in radius(1) from destination where not Pawn
  }
}

핵심 문법:

  • remove pieces in radius(N) from <position>: N칸 반경 내 모든 기물 제거
  • where not <Type>: 특정 타입 제외 (폰은 폭발에서 살아남음)
  • destination: 잡기가 발생한 위치

Trapper Chess (덫 설치자 체스)

트래퍼 기물이 이동한 자리에 덫을 설치할 수 있습니다. 선택적 트리거를 사용합니다.

chesslang
game: "Trapper Chess"
extends: "Standard Chess"

# 덫 효과: 적 이동 차단
effect trap {
  blocks: enemy
  visual: "red"
}

piece Trapper {
  move: step(any)
  capture: =move
  state: { traps: 0 }
  value: 3
}

# 선택적 트리거: 사용자가 덫 설치 여부 선택
trigger place_trap {
  on: move
  when: piece.type == Trapper and piece.state.traps < 3
  optional: true
  description: "덫을 설치하시겠습니까?"
  do: {
    mark origin with trap
    set piece.state.traps = piece.state.traps + 1
  }
}

setup:
  add:
    White Trapper: [c1]
    Black Trapper: [c8]

스크립트 변형 (레벨 3)

Progressive Chess

각 턴마다 이동 횟수가 1씩 증가합니다.

chesslang
game: "Progressive Chess"
extends: "Standard Chess"

script {
  game.state.movesThisTurn = 0;
  game.state.movesRequired = 1;

  game.on("move", function(event) {
    game.state.movesThisTurn++;
    var opponent = event.player === "White" ? "Black" : "White";

    if (game.isCheck(opponent)) {
      game.endTurn();
      return;
    }

    if (game.state.movesThisTurn >= game.state.movesRequired) {
      game.endTurn();
    }
  });

  game.on("turnEnd", function(event) {
    game.state.movesRequired++;
    game.state.movesThisTurn = 0;
  });
}

Countdown Chess

각 플레이어당 50수 제한입니다.

chesslang
game: "Countdown Chess"
extends: "Standard Chess"

script {
  game.state.whiteMoves = 50;
  game.state.blackMoves = 50;

  game.on("move", function(event) {
    if (event.player === "White") {
      game.state.whiteMoves--;
      console.log("백 남은 이동:", game.state.whiteMoves);
      if (game.state.whiteMoves <= 0) {
        game.declareWinner("Black", "백이 이동 횟수를 소진함");
      }
    } else {
      game.state.blackMoves--;
      console.log("흑 남은 이동:", game.state.blackMoves);
      if (game.state.blackMoves <= 0) {
        game.declareWinner("White", "흑이 이동 횟수를 소진함");
      }
    }
    game.endTurn();
  });
}

Material Race

15점어치의 기물을 먼저 잡으면 승리합니다.

chesslang
game: "Material Race"
extends: "Standard Chess"

script {
  game.state.whiteCaptures = 0;
  game.state.blackCaptures = 0;

  var pieceValues = {
    "Pawn": 1,
    "Knight": 3,
    "Bishop": 3,
    "Rook": 5,
    "Queen": 9
  };

  game.on("capture", function(event) {
    var capturedType = event.captured.type;
    var value = pieceValues[capturedType] || 0;

    if (event.player === "White") {
      game.state.whiteCaptures += value;
      console.log("백 잡은 점수:", game.state.whiteCaptures);
      if (game.state.whiteCaptures >= 15) {
        game.declareWinner("White", "15점 달성");
      }
    } else {
      game.state.blackCaptures += value;
      console.log("흑 잡은 점수:", game.state.blackCaptures);
      if (game.state.blackCaptures >= 15) {
        game.declareWinner("Black", "15점 달성");
      }
    }
  });
}

큰 보드 변형

Capablanca Chess (10x8)

챈슬러와 대주교가 추가된 10x8 보드입니다.

chesslang
game: "Capablanca Chess"
extends: "Standard Chess"

board:
  size: 10x8

piece Chancellor {
  move: slide(orthogonal) | leap(2, 1)
  capture: =move
  value: 9
}

piece Archbishop {
  move: slide(diagonal) | leap(2, 1)
  capture: =move
  value: 8
}

setup:
  White:
    King: [f1]
    Queen: [e1]
    Chancellor: [h1]
    Archbishop: [c1]
    Rook: [a1, j1]
    Bishop: [d1, g1]
    Knight: [b1, i1]
    Pawn: [a2, b2, c2, d2, e2, f2, g2, h2, i2, j2]
  Black:
    King: [f8]
    Queen: [e8]
    Chancellor: [h8]
    Archbishop: [c8]
    Rook: [a8, j8]
    Bishop: [d8, g8]
    Knight: [b8, i8]
    Pawn: [a7, b7, c7, d7, e7, f7, g7, h7, i7, j7]

Mini Chess (5x6)

작은 보드의 빠른 게임입니다.

chesslang
game: "Mini Chess"
extends: "Standard Chess"

board:
  size: 5x6

setup:
  White:
    King: [c1]
    Queen: [b1]
    Rook: [a1, e1]
    Bishop: [d1]
    Pawn: [a2, b2, c2, d2, e2]
  Black:
    King: [c6]
    Queen: [b6]
    Rook: [a6, e6]
    Bishop: [d6]
    Pawn: [a5, b5, c5, d5, e5]

더 알아보기