메뉴
HN
Hacker News 44일 전

최적의 카드놀이 전략 탐색기: 현재 최고 승률 8.590%

IMP
3/10
핵심 요약

카드 놀이(솔리테어)의 최적의 플레이 전략을 찾기 위한 시뮬레이터입니다. 단순한 이동 규칙의 우선순위를 변경하여 승률을 기존 7.915%에서 8.590%로 향상시켰습니다. Apache Ant로 빌드할 수 있으며, 사용자가 시드(Seed) 값과 게임 횟수 등을 설정하여 대량의 게임을 시뮬레이션하고 승률을 분석할 수 있습니다.

번역된 본문

최적의 플레이 전략을 찾기 위한 카드 놀이(솔리테어) 시뮬레이터... 현재 최고 승률은 8.590%입니다.

버전 1.0 s2g, b2g, b2b, s2b만 사용하는 매우 기본적인 플레이. 똑똑한 대안을 사용하는 노력이 전혀 없습니다. 예를 들어, | 9♠︎ |와 | 9♣︎ |가 모두 | 10♥︎ | 위에 놓일 수 있지만, 단지 처음 마주치는 카드가 다른 것보다 먼저 선택됩니다. 1.1 플레이 방식은 1.0과 동일하지만, 시드(Seed) 매개변수를 통해 덱 셔플을 반복할 수 있습니다. 1.2 플레이 순서가 {s2g, b2g, b2b, s2b}에서 {s2g, b2b, b2g, s2b}로 변경되었습니다. 승률이 7.915%에서 8.590%로 증가했습니다.

사용 방법: ant 실행 Apache Ant를 사용하여 기본 build.xml로 프로젝트를 빌드합니다. 타겟은 "clean"과 "compile.java"입니다. 기본값은 둘 다 실행하는 것입니다.

java -jar simulator.jar 실행 사용법: [--one|--three] [--attempts #] [--debug] [--seed #] --one : 매 플레이마다 카드를 한 장만 뒤집습니다. --three : 매 플레이마다 카드를 세 장 뒤집습니다. --attempts : 시도할 게임의 수. --debug : 각 게임에 대한 상세 출력. --seed : 반복 가능한 플레이를 위한 무작위 시드.

예시: java -jar simulator.jar --three --attempts 10 --seed 1111 > debug.out 2> debug.err 시뮬레이터 jar 파일을 사용하여 자바를 실행합니다. 매 턴마다 세 장의 카드를 뒤집습니다. 10게임을 진행합니다. 1111 시드로 덱을 섞습니다. 표준 출력을 debug.out에 기록합니다. 이긴 게임만 출력됩니다. 표준 에러를 debug.err에 기록합니다. 디버그 스위치가 없으면 에러만 출력됩니다. 디버그가 있으면 모든 게임이 출력됩니다.

java -jar simulator.jar --three --attempts 1000000 --seed 1111 을 실행하여 현재 기록 대비 본인의 성공률을 확인하세요. M2 맥북 에어에서 백만 번의 게임은(디버그 없이) 1시간 이내에 완료됩니다.

범례 |•A♦︎•|: 뒤집힌 다이아몬드 A. | A♦︎ |: 앞면이 보이는 다이아몬드 A. b2b: 보드(Board)에서 보드로 b2g: 보드에서 골(Goal)로 g2b: 골에서 보드로 s2b: 스택(Stack)에서 보드로 s2g: 스택에서 골로

출력 예시 매개변수 없이 실행했을 때의 출력: 사용법: [--one|--three] [--attempts #] [--debug] [--seed #] --one: 매 플레이마다 카드를 한 장만 뒤집습니다. --three: 매 플레이마다 카드를 세 장 뒤집습니다. --attempts: 시도할 게임의 수. --debug: 각 게임에 대한 상세 출력. --seed: 반복 가능한 플레이를 위한 무작위 시드.

실행 중: 디버그 및 시드 없이 3장의 카드를 뒤집고 10번 시도 10번 중 0번째 게임 10번 중 1번째 게임 10번 중 2번째 게임 10번 중 3번째 게임 10번 중 4번째 게임 10번 중 5번째 게임 10번 중 6번째 게임 10번 중 7번째 게임 10번 중 8번째 게임 ================== 승리자 ==================

====================== === 골 =============
====================== === 보드 ============
| A♣︎ | 
|•J♣︎•|| Q♣︎ | 
|•10♠︎•||•9♠︎•|| Q♥︎ | 
|•A♥︎•||•J♥︎•||•2♦︎•|| 9♣︎ | 
|•7♦︎•||•6♦︎•||•3♠︎•||•10♣︎•|| 5♠︎ | 
|•Q♠︎•||•7♥︎•||•2♥︎•||•8♥︎•||•A♠︎•|| 3♥︎ | 
|•8♠︎•||•7♠︎•||•10♥︎•||•5♦︎•||•K♣︎•||•K♥︎•|| 4♦︎ | 
====================== === 스택 ============
|•8♦︎•||•8♣︎•||•2♠︎•||•J♦︎•||•10♦︎•||•3♦︎•||•4♠︎•||•5♥︎•||•6♠︎•||•4♥︎•||•9♦︎•||•6♣︎•||•Q♦︎•||•5♣︎•||•9♥︎•||•J♠︎•||•K♠︎•||•K♦︎•||•4♣︎•||•6♥︎•||•3♣︎•||•7♣︎•||•A♦︎•||•2♣︎•| 
~~~ s2g >> 루프: 0 | 플롭:0 ~~~~~~~~~
====================== === 골 =============
====================== === 보드 ============
| A♣︎ | 
|•J♣︎•|| Q♣︎ | 
|•10♠︎•||•9♠︎•|| Q♥︎ | 
|•A♥︎•||•J♥︎•||•2♦︎•|| 9♣︎ | 
|•7♦︎•||•6♦︎•||•3♠︎•||•10♣︎•|| 5♠︎ | 
|•Q♠︎•||•7♥︎•||•2♥︎•||•8♥︎•||•A♠︎•|| 3♥︎ | 
|•8♠︎•||•7♠︎•||•10♥︎•||•5♦︎•||•K♣︎•||•K♥︎•|| 4♦︎ | 
====================== === 스택 ============
|•8♦︎•||•8♣︎•||•2♠︎•||•J♦︎•||•10♦︎•||•3♦︎•||•4♠︎•||•5♥︎•||•6♠︎•||•4♥︎•||•9♦︎•||•6♣︎•||•Q♦︎•||•5♣︎•||•9♥︎•||•J♠︎•||•K♠︎•||•K♦︎•||•4♣︎•||•6♥︎•||•3♣︎•| | 2♣︎ || A♦︎ || 7♣︎ | 
~~~ b2b >> 루프: 1 | 플롭:0 ~~~~~~~~~
====================== === 골 =============
====================== === 보드 ============
| A♣︎ | 
|•J♣︎•|| Q♣︎ | 
|•10♠︎•||•9♠︎•|| Q♥︎ | 
|•A♥︎•||•J♥︎•||•2♦︎•|| 9♣︎ | 
|•7♦︎•||•6♦︎•||•3♠︎•||•10♣︎•|| 5♠︎ || 4♦︎ | 
|•Q♠︎•||•7♥︎•||•2♥︎•||•8♥︎•||•A♠︎•|| 3♥︎ | 
|•8♠︎•||•7♠︎•||•10♥︎•||•5♦︎•||•K♣︎•|| K♥︎ | 
====================== === 스택 ============
|•8♦︎•||•8♣︎•||•2♠︎•||•J♦︎•||•10♦︎•||•3♦︎•||•4♠︎•||•5♥︎•||•6♠︎•||•4♥︎•||•9♦︎•||•6♣︎•||•Q♦︎•||•5♣︎•||•9♥︎•||•J♠︎•||•K♠︎•||•K♦︎•||
원문 보기
원문 보기 (영어)
Solitaire simulator for finding the best strategy... Current record is 8.590%. Versions 1.0 Very basic play using s2g, b2g, b2b, s2b only. No effort to using smart alternatives. For example | 9♠︎ | and | 9♣︎ | are both playable on | 10♥︎ |, but nothing but first encounter will choose one over the other. 1.1 Play is the same as 1.0, but deck shuffling can be repeatable via the seed parameter. 1.2 Play changed from {s2g, b2g, b2b, s2b} to {s2g, b2b, b2g, s2b} sequencing. Winning percentage increased from 7.915% to 8.590%. How To: run ant Using Apache Ant to build project with default build.xml. Targets are "clean" and "compile.java". Default runs both. run java -jar simulator.jar usage: [--one|--three] [--attempts #] [--debug] [--seed #] --one : Turn only one card each play. --three : Turn three cards each play. --attempts : Number of games to attempt. --debug : Verbose output about each game. --seed : Random seed for repeatable play. For example: java -jar simulator.jar --three --attempts 10 --seed 1111 > debug.out 2> debug.err Run java with the simulator jar. Turn three cards for each turn. Play ten games. Shuffle the deck starting with the seed 1111. Write standard output to debug.out. Only winning games will be output. Write standard error to debug.err. Without the debug switch, only errors will be output. With debug, all games are output. run java -jar simulator.jar --three --attempts 1000000 --seed 1111 to determine your success rate verses the current record. One million games takes less than an hour (without debug) on M2 MacBook Air. Legend |•A♦︎•|: Ace of Diamonds face down. | A♦︎ |: Ace of Diamonds face up. b2b: from Board to Board b2g: from Board to Goal g2b: from Goal to Board s2b: from Stack to Board s2g: from Stack to Goal Example Output Output from a no parameter run: usage: [--one|--three] [--attempts #] [--debug] [--seed #] --one: Turn only one card each play. --three: Turn three cards each play. --attempts: Number of games to attempt. --debug: Verbose output about each game. --seed: Random seed for repeatable play. running: turn 3 cards and 10 attempts without debug without a seed Game 0 of 10 Game 1 of 10 Game 2 of 10 Game 3 of 10 Game 4 of 10 Game 5 of 10 Game 6 of 10 Game 7 of 10 Game 8 of 10 ================== WINNER ================== ~~~~~~~~~~~~~~~~~~ ~~~ Ready to Play ~~~~~~~~~ ====================== === Goal ============= ====================== === Board ============ | A♣︎ | |•J♣︎•|| Q♣︎ | |•10♠︎•||•9♠︎•|| Q♥︎ | |•A♥︎•||•J♥︎•||•2♦︎•|| 9♣︎ | |•7♦︎•||•6♦︎•||•3♠︎•||•10♣︎•|| 5♠︎ | |•Q♠︎•||•7♥︎•||•2♥︎•||•8♥︎•||•A♠︎•|| 3♥︎ | |•8♠︎•||•7♠︎•||•10♥︎•||•5♦︎•||•K♣︎•||•K♥︎•|| 4♦︎ | ====================== === Stack ============ |•8♦︎•||•8♣︎•||•2♠︎•||•J♦︎•||•10♦︎•||•3♦︎•||•4♠︎•||•5♥︎•||•6♠︎•||•4♥︎•||•9♦︎•||•6♣︎•||•Q♦︎•||•5♣︎•||•9♥︎•||•J♠︎•||•K♠︎•||•K♦︎•||•4♣︎•||•6♥︎•||•3♣︎•||•7♣︎•||•A♦︎•||•2♣︎•| ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~ s2g >> loops: 0 | flops:0 ~~~~~~~~~ ====================== === Goal ============= ====================== === Board ============ | A♣︎ | |•J♣︎•|| Q♣︎ | |•10♠︎•||•9♠︎•|| Q♥︎ | |•A♥︎•||•J♥︎•||•2♦︎•|| 9♣︎ | |•7♦︎•||•6♦︎•||•3♠︎•||•10♣︎•|| 5♠︎ | |•Q♠︎•||•7♥︎•||•2♥︎•||•8♥︎•||•A♠︎•|| 3♥︎ | |•8♠︎•||•7♠︎•||•10♥︎•||•5♦︎•||•K♣︎•||•K♥︎•|| 4♦︎ | ====================== === Stack ============ |•8♦︎•||•8♣︎•||•2♠︎•||•J♦︎•||•10♦︎•||•3♦︎•||•4♠︎•||•5♥︎•||•6♠︎•||•4♥︎•||•9♦︎•||•6♣︎•||•Q♦︎•||•5♣︎•||•9♥︎•||•J♠︎•||•K♠︎•||•K♦︎•||•4♣︎•||•6♥︎•||•3♣︎•| | 2♣︎ || A♦︎ || 7♣︎ | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~ b2b >> loops: 1 | flops:0 ~~~~~~~~~ ====================== === Goal ============= ====================== === Board ============ | A♣︎ | |•J♣︎•|| Q♣︎ | |•10♠︎•||•9♠︎•|| Q♥︎ | |•A♥︎•||•J♥︎•||•2♦︎•|| 9♣︎ | |•7♦︎•||•6♦︎•||•3♠︎•||•10♣︎•|| 5♠︎ || 4♦︎ | |•Q♠︎•||•7♥︎•||•2♥︎•||•8♥︎•||•A♠︎•|| 3♥︎ | |•8♠︎•||•7♠︎•||•10♥︎•||•5♦︎•||•K♣︎•|| K♥︎ | ====================== === Stack ============ |•8♦︎•||•8♣︎•||•2♠︎•||•J♦︎•||•10♦︎•||•3♦︎•||•4♠︎•||•5♥︎•||•6♠︎•||•4♥︎•||•9♦︎•||•6♣︎•||•Q♦︎•||•5♣︎•||•9♥︎•||•J♠︎•||•K♠︎•||•K♦︎•||•4♣︎•||•6♥︎•||•3♣︎•| | 2♣︎ || A♦︎ || 7♣︎ | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~ b2b >> loops: 2 | flops:0 ~~~~~~~~~ ====================== === Goal ============= ====================== === Board ============ | A♣︎ | | J♣︎ | |•10♠︎•||•9♠︎•|| Q♥︎ | |•A♥︎•||•J♥︎•||•2♦︎•|| 9♣︎ | |•7♦︎•||•6♦︎•||•3♠︎•||•10♣︎•|| 5♠︎ || 4♦︎ | |•Q♠︎•||•7♥︎•||•2♥︎•||•8♥︎•||•A♠︎•|| 3♥︎ | |•8♠︎•||•7♠︎•||•10♥︎•||•5♦︎•||•K♣︎•|| K♥︎ || Q♣︎ | ====================== === Stack ============ |•8♦︎•||•8♣︎•||•2♠︎•||•J♦︎•||•10♦︎•||•3♦︎•||•4♠︎•||•5♥︎•||•6♠︎•||•4♥︎•||•9♦︎•||•6♣︎•||•Q♦︎•||•5♣︎•||•9♥︎•||•J♠︎•||•K♠︎•||•K♦︎•||•4♣︎•||•6♥︎•||•3♣︎•| | 2♣︎ || A♦︎ || 7♣︎ | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~ b2b >> loops: 3 | flops:0 ~~~~~~~~~ ====================== === Goal ============= ====================== === Board ============ | A♣︎ | |•10♠︎•||•9♠︎•|| Q♥︎ || J♣︎ | |•A♥︎•||•J♥︎•||•2♦︎•|| 9♣︎ | |•7♦︎•||•6♦︎•||•3♠︎•||•10♣︎•|| 5♠︎ || 4♦︎ | |•Q♠︎•||•7♥︎•||•2♥︎•||•8♥︎•||•A♠︎•|| 3♥︎ | |•8♠︎•||•7♠︎•||•10♥︎•||•5♦︎•||•K♣︎•|| K♥︎ || Q♣︎ | ====================== === Stack ============ |•8♦︎•||•8♣︎•||•2♠︎•||•J♦︎•||•10♦︎•||•3♦︎•||•4♠︎•||•5♥︎•||•6♠︎•||•4♥︎•||•9♦︎•||•6♣︎•||•Q♦︎•||•5♣︎•||•9♥︎•||•J♠︎•||•K♠︎•||•K♦︎•||•4♣︎•||•6♥︎•||•3♣︎•| | 2♣︎ || A♦︎ || 7♣︎ | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~ b2b >> loops: 4 | flops:0 ~~~~~~~~~ ====================== === Goal ============= ====================== === Board ============ | A♣︎ | | K♥︎ | |•10♠︎•||•9♠︎•|| Q♥︎ || J♣︎ | |•A♥︎•||•J♥︎•||•2♦︎•|| 9♣︎ | |•7♦︎•||•6♦︎•||•3♠︎•||•10♣︎•|| 5♠︎ || 4♦︎ | |•Q♠︎•||•7♥︎•||•2♥︎•||•8♥︎•||•A♠︎•|| 3♥︎ | |•8♠︎•||•7♠︎•||•10♥︎•||•5♦︎•||•K♣︎•|| Q♣︎ | ====================== === Stack ============ |•8♦︎•||•8♣︎•||•2♠︎•||•J♦︎•||•10♦︎•||•3♦︎•||•4♠︎•||•5♥︎•||•6♠︎•||•4♥︎•||•9♦︎•||•6♣︎•||•Q♦︎•||•5♣︎•||•9♥︎•||•J♠︎•||•K♠︎•||•K♦︎•||•4♣︎•||•6♥︎•||•3♣︎•| | 2♣︎ || A♦︎ || 7♣︎ | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~ b2b >> loops: 5 | flops:0 ~~~~~~~~~ ====================== === Goal ============= ====================== === Board ============ | A♣︎ | | K♥︎ || Q♣︎ | |•10♠︎•||•9♠︎•|| Q♥︎ || J♣︎ | |•A♥︎•||•J♥︎•||•2♦︎•|| 9♣︎ | |•7♦︎•||•6♦︎•||•3♠︎•||•10♣︎•|| 5♠︎ || 4♦︎ | |•Q♠︎•||•7♥︎•||•2♥︎•||•8♥︎•||•A♠︎•|| 3♥︎ | |•8♠︎•||•7♠︎•||•10♥︎•||•5♦︎•|| K♣︎ | ====================== === Stack ============ |•8♦︎•||•8♣︎•||•2♠︎•||•J♦︎•||•10♦︎•||•3♦︎•||•4♠︎•||•5♥︎•||•6♠︎•||•4♥︎•||•9♦︎•||•6♣︎•||•Q♦︎•||•5♣︎•||•9♥︎•||•J♠︎•||•K♠︎•||•K♦︎•||•4♣︎•||•6♥︎•||•3♣︎•| | 2♣︎ || A♦︎ || 7♣︎ | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~ b2b >> loops: 6 | flops:0 ~~~~~~~~~ ====================== === Goal ============= ====================== === Board ============ | A♣︎ | | K♥︎ || Q♣︎ | |•10♠︎•|| 9♠︎ | |•A♥︎•||•J♥︎•||•2♦︎•|| 9♣︎ | |•7♦︎•||•6♦︎•||•3♠︎•||•10♣︎•|| 5♠︎ || 4♦︎ | |•Q♠︎•||•7♥︎•||•2♥︎•||•8♥︎•||•A♠︎•|| 3♥︎ | |•8♠︎•||•7♠︎•||•10♥︎•||•5♦︎•|| K♣︎ || Q♥︎ || J♣︎ | ====================== === Stack ============ |•8♦︎•||•8♣︎•||•2♠︎•||•J♦︎•||•10♦︎•||•3♦︎•||•4♠︎•||•5♥︎•||•6♠︎•||•4♥︎•||•9♦︎•||•6♣︎•||•Q♦︎•||•5♣︎•||•9♥︎•||•J♠︎•||•K♠︎•||•K♦︎•||•4♣︎•||•6♥︎•||•3♣︎•| | 2♣︎ || A♦︎ || 7♣︎ | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~ b2g >> loops: 7 | flops:0 ~~~~~~~~~ ====================== === Goal ============= | A♣︎ | ====================== === Board ============ | K♥︎ || Q♣︎ | |•10♠︎•|| 9♠︎ | |•A♥︎•||•J♥︎•||•2♦︎•|| 9♣︎ | |•7♦︎•||•6♦︎•||•3♠︎•||•10♣︎•|| 5♠︎ || 4♦︎ | |•Q♠︎•||•7♥︎•||•2♥︎•||•8♥︎•||•A♠︎•|| 3♥︎ | |•8♠︎•||•7♠︎•||•10♥︎•||•5♦︎•|| K♣︎ || Q♥︎ || J♣︎ | ====================== === Stack ============ |•8♦︎•||•8♣︎•||•2♠︎•||•J♦︎•||•10♦︎•||•3♦︎•||•4♠︎•||•5♥︎•||•6♠︎•||•4♥︎•||•9♦︎•||•6♣︎•||•Q♦︎•||•5♣︎•||•9♥︎•||•J♠︎•||•K♠︎•||•K♦︎•||•4♣︎•||•6♥︎•||•3♣︎•| | 2♣︎ || A♦︎ || 7♣︎ | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ~~~ s.flip >> loops: 8 | flops:0 ~~~~~~~~~ ====================== === Goal ============= | A♣︎ | ====================== === Board ============ | K♥︎ || Q♣︎ | |•10♠︎•|| 9♠︎ | |•A♥︎•||•J♥︎•||•2♦︎•|| 9♣︎ | |•7♦︎•||•6♦︎•||•3♠︎•||•10♣︎•|| 5♠︎ || 4♦︎ | |•Q♠︎•||•7♥︎•||•2♥︎•||•8♥︎•||•A♠︎•|| 3♥︎ | |•8♠︎•||•7♠︎•||•10♥︎•||•5♦︎•|| K♣︎ || Q♥︎ || J♣︎ | =====================