Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChecksMate: implement new game #2507

Open
wants to merge 256 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
256 commits
Select commit Hold shift + click to select a range
53eafc7
still dont understand python typing
chesslogic Oct 22, 2023
504de89
attempt to generate something real
chesslogic Oct 23, 2023
c632da2
Merge branch 'main' of https://github.com/ArchipelagoMW/Archipelago i…
chesslogic Oct 23, 2023
6b91732
there is now some sort of logic
chesslogic Oct 23, 2023
f4f4ea1
improve compatibility with starting inventory
chesslogic Oct 23, 2023
2015c70
players should not have more than 5 queens. i think you can still hav…
chesslogic Oct 24, 2023
ab62a57
add some helpful TODOs to not blow up logic later
chesslogic Oct 24, 2023
283a107
add some extra locations to support distributing more items
chesslogic Oct 24, 2023
7af3330
support various threats and stop adding Unplaced Items
chesslogic Oct 24, 2023
28bc9f9
remove debug
chesslogic Oct 25, 2023
ce81d45
rename threats for clarity
chesslogic Oct 25, 2023
c0626c4
reword threats, tweak ELO scaling
chesslogic Oct 25, 2023
c8f4a9d
added triple fork instead of pin because it's easier
chesslogic Oct 25, 2023
4aec531
clean up special locations
chesslogic Oct 25, 2023
bb0779c
a/b test remove redundant min material segment
chesslogic Oct 25, 2023
984f341
set default goal
chesslogic Oct 26, 2023
5d82916
if user sets random material ranges, handle reverse overlap
chesslogic Oct 26, 2023
7ccec5f
redistribute items so players see more pawns and rooks
chesslogic Oct 26, 2023
6656392
remove debug print
chesslogic Oct 26, 2023
eca4e7a
prevent 5 queens and 1 major in pool
chesslogic Oct 27, 2023
c700d53
remove french move from pool because it is impossible :( (impractical)
chesslogic Oct 27, 2023
9e1f91b
fmt
chesslogic Oct 29, 2023
f99e2c5
fix broken victory item
chesslogic Oct 29, 2023
51ed0a5
fmt
chesslogic Oct 29, 2023
924da69
fix multiplayer generation
chesslogic Nov 1, 2023
85fb5ca
support higher maximum material for absurd games
chesslogic Nov 2, 2023
4adc577
remove higher material support
chesslogic Nov 2, 2023
c2e9840
fix victory items scattered through world
chesslogic Nov 2, 2023
63d84ba
cleanup options
chesslogic Nov 2, 2023
3e69a5e
add starting items and early items to counted material
chesslogic Nov 2, 2023
88910c4
when at first you don't Victory, try again
chesslogic Nov 3, 2023
0dcc0c6
early support for Armies
chesslogic Nov 4, 2023
a059aee
update piece limit logic
chesslogic Nov 5, 2023
64caa4f
improve material item distribution
chesslogic Nov 5, 2023
f9402d9
Update CODEOWNERS
chesslogic Nov 5, 2023
71bd6aa
add some docs
chesslogic Nov 6, 2023
0db2039
Merge branch 'main' of https://github.com/ArchipelagoMW/Archipelago i…
chesslogic Nov 6, 2023
e9d2581
support piece limits, rename folder
chesslogic Nov 6, 2023
d46069b
Update CODEOWNERS
chesslogic Nov 6, 2023
40fbafc
simplify tests, add children functionality to piece check
chesslogic Nov 6, 2023
0a3bad8
fix misalignment of item and location pool
chesslogic Nov 6, 2023
ae5c318
clarify meaning of user_item_count
chesslogic Nov 6, 2023
2d821a2
rename converter to limit by type
chesslogic Nov 7, 2023
5c962fd
Add DeathLink.
chesslogic Nov 9, 2023
6201bbd
Update item difficulty and add Consuls/MountedKings
chesslogic Nov 9, 2023
b0056de
on tuesday i broke something
chesslogic Nov 10, 2023
2ce5f85
remove special from kings opts
chesslogic Nov 10, 2023
32af002
update seed cases
chesslogic Nov 10, 2023
bb5ff44
Separate Location and Item IDs.
chesslogic Nov 10, 2023
9ea7024
small fix to allow disabling fairy kings
chesslogic Nov 11, 2023
86e670b
capturing multiple pawns is way harder than I thought
chesslogic Nov 11, 2023
c6b30c8
small AI-related tweaks to capture expectations
chesslogic Nov 12, 2023
3045d22
count specific piece locations to prepare for progressive checkmate goal
chesslogic Nov 12, 2023
35bfe21
Add "ELO reduction" to items player can remove
chesslogic Nov 13, 2023
6cf26bd
Tweaks to material requirements, more pawns
chesslogic Nov 16, 2023
ef1bc1f
Add clarity on multiworld settings
chesslogic Nov 16, 2023
d1e4d22
support castles, max pocket, and locked items
chesslogic Nov 19, 2023
0813f69
minor: update deathlink wording
chesslogic Nov 21, 2023
e6bd565
increase enemy piece costs, todo a locked_items algorithm
chesslogic Nov 21, 2023
a690076
raise sequences costs, relax chessmen count
chesslogic Nov 22, 2023
736be0c
more specific chessmen count
chesslogic Nov 22, 2023
be91e6b
minor: remove resolved todo
chesslogic Nov 25, 2023
31b9826
Move required material into Locations
chesslogic Nov 25, 2023
b75b578
refactor away logicmixin, add minimal to test accessibility
chesslogic Nov 25, 2023
7166ad3
use local random instead of per_slot_randoms
chesslogic Nov 25, 2023
655006e
reference self.random, compile rules
chesslogic Nov 25, 2023
55aec09
collect material, improve item groups, precollect enemies
chesslogic Nov 26, 2023
eaa764c
Merge branch 'main' into checks_mate
chesslogic Nov 26, 2023
f0bbf57
Update by deprecation. Start Options API.
chesslogic Nov 26, 2023
311cf17
Continue Options API migration
chesslogic Nov 26, 2023
cd9af44
Convert to Options API except for limits dictionary
chesslogic Nov 26, 2023
e78513f
Remove get_option_value
chesslogic Nov 26, 2023
7604113
Move limits to CMOptions static property
chesslogic Nov 26, 2023
481fd94
change version
chesslogic Nov 26, 2023
b13668c
improve material count, fumble with caching
chesslogic Nov 26, 2023
040ffe5
most of these are implemented
chesslogic Nov 26, 2023
58eaaa0
start counting material in tests
chesslogic Nov 26, 2023
d95f129
update tests for Options API
chesslogic Nov 26, 2023
aead4b9
The actual "bug"
chesslogic Nov 26, 2023
daf1f87
Merge branch 'options_tests' into checks_mate
chesslogic Nov 26, 2023
64fba66
failing tests for material count
chesslogic Nov 26, 2023
773be76
exclude inaccessible locations
chesslogic Nov 27, 2023
bf6cab6
possible pawn promotion location
chesslogic Nov 27, 2023
f232b02
improve collect to dict
chesslogic Nov 27, 2023
04b03b7
improve advanced collect debug
chesslogic Nov 27, 2023
2c62ddb
fix for excluded items miscounted in material
chesslogic Nov 27, 2023
2941497
minor: comments on collect and limit
chesslogic Nov 28, 2023
2e581a0
add a test for material
chesslogic Nov 28, 2023
f51fd6f
test for removing material
chesslogic Nov 28, 2023
cd6dd8e
describe material tests
chesslogic Nov 28, 2023
ba187f8
minor: do not copy paste your tests
chesslogic Nov 28, 2023
d819bbd
omit double negative in remove()
chesslogic Nov 29, 2023
c0399dd
remove starting item from material tests
chesslogic Nov 29, 2023
fc64f53
added custom non-cwda pieces
chesslogic Nov 30, 2023
2d10a0a
Replace FairyChessPieces with OptionSet, currently hidden on website …
chesslogic Nov 30, 2023
f63a44b
update army generation for optionset
chesslogic Nov 30, 2023
d99e878
unified army piece limits
chesslogic Nov 30, 2023
9f543c7
update limit for queennon
chesslogic Nov 30, 2023
a980993
fix wording errors wrt Ralph Betza's CwDA
chesslogic Nov 30, 2023
219d9b2
Increase {fairy+extra} king values
chesslogic Nov 30, 2023
31d3d93
not a fan of name "eurasian"
chesslogic Nov 30, 2023
904cfaf
Merge branch 'main' of https://github.com/ArchipelagoMW/Archipelago i…
chesslogic Nov 30, 2023
e1a78b7
change default types to stable
chesslogic Dec 2, 2023
c1e527e
move and rename options
chesslogic Dec 2, 2023
0324164
account for material costs of locked items
chesslogic Dec 2, 2023
45c8ef2
Create checksmate-example.yaml
chesslogic Dec 2, 2023
3629081
Add 4 example yaml configurations
chesslogic Dec 2, 2023
84d1ef8
handle invalid OptionSet of fairy chess pieces
chesslogic Dec 2, 2023
2b21982
minor: options wording around fide
chesslogic Dec 2, 2023
9c0cdb5
minor: reword vanilla comment in army generation
chesslogic Dec 3, 2023
383a478
improve standard examples
chesslogic Dec 3, 2023
c927124
change some default settings
chesslogic Dec 3, 2023
e3002a7
add not set (extremely important logic change)
chesslogic Dec 5, 2023
939d62d
rename king locations, add a test
chesslogic Dec 7, 2023
fda83ed
increase checkmate maxima cost
chesslogic Dec 7, 2023
2394ef6
minor: set type for yaml_locked_items
chesslogic Dec 7, 2023
f3a6d77
observe lockable items
chesslogic Dec 8, 2023
6b8043a
transfer examples to presets (incomplete)
chesslogic Dec 10, 2023
27886d2
continue preset conversions
chesslogic Dec 11, 2023
16ef70b
locations own their chessmen_expectations
chesslogic Dec 11, 2023
178b36c
reverse is not reversed
chesslogic Dec 11, 2023
94ac925
exclude impossible locations
chesslogic Dec 11, 2023
4bf9f4e
minor: tweak win cost
chesslogic Dec 11, 2023
3c21ecc
realised accessibility must remove items not lock others
chesslogic Dec 12, 2023
fdca34b
outline of castling and chessmen locking
chesslogic Dec 12, 2023
9b6b05e
determine lockable value of major
chesslogic Dec 12, 2023
23affe8
fix for min material range
chesslogic Dec 12, 2023
2a294c7
improve locking queen value
chesslogic Dec 12, 2023
d84a460
simplify material limits
chesslogic Dec 12, 2023
6cd878b
avoid counting past limits in wont_fit
chesslogic Dec 15, 2023
8b2788e
no idea why but i updated requirements.txt
chesslogic Dec 15, 2023
0b13ecd
Merge branch 'main' into checks_mate
chesslogic Dec 15, 2023
6df55ab
add bounding to material tests
chesslogic Dec 19, 2023
2b03bd1
Fix impossible logic
chesslogic Jan 2, 2024
bd5a7ff
someone wanted this to be a loop so now it is
chesslogic Jan 2, 2024
6c7e26c
the AI takes midgame locations very seriously
chesslogic Feb 4, 2024
ddb3b17
simplify self.multiworld, self.player in __init__
chesslogic Feb 9, 2024
72e272e
Simple performance improvement via reading property directly
chesslogic Feb 9, 2024
9c48f2b
store upgrade count for Universal Tracker
chesslogic Feb 11, 2024
55ade96
Add faster "total queens" to castle rules
chesslogic Feb 24, 2024
57902b2
Merge branch 'main' into checks_mate
chesslogic Feb 24, 2024
838ead9
Allow 32 pawns instead of 14
chesslogic Mar 11, 2024
a876a82
Maximize forwardness
chesslogic Mar 11, 2024
5c34a9e
fix for pocket_limit div 0
chesslogic Apr 18, 2024
a6cd42a
fix inline ifelse bug in chessmen count
chesslogic Jun 8, 2024
9f46e67
initial ideas on difficulty
chesslogic Jun 8, 2024
faf2248
move difficulty to safer file
chesslogic Jun 8, 2024
2144259
more capture locations, so as to support "oops all pawns" item distri…
chesslogic Jun 10, 2024
718d260
trivial change to castle locations chessmen expectations
chesslogic Jun 10, 2024
a19d3db
Merge branch 'main' into checks_mate
chesslogic Jun 10, 2024
d7d9932
introduce bug forcing pocket items but add more pawn forwardness for …
chesslogic Jun 10, 2024
bb8a370
add fairy_chess_piece_collection as an alternative to fairy_chess_pie…
chesslogic Jun 15, 2024
300305f
what I've done consistently breaks item placement somehow
chesslogic Jun 15, 2024
8a8afbd
tweak difficulty scaling. also fix inline if/else bug. I literally ju…
chesslogic Jun 15, 2024
4120f61
summarize difficulty
chesslogic Jun 15, 2024
e214b10
clarify max material text (39 vs 40)
chesslogic Jun 16, 2024
186d999
Import DeathLink in options. Reverse a dumb core change.
chesslogic Jun 16, 2024
bd66703
Merge branch 'main' into checks_mate
chesslogic Jun 18, 2024
2dfe062
start updating tests for changes in fairy piece options
chesslogic Jun 19, 2024
244a618
move inline chessmen_expectations into function (adds fn overhead but…
chesslogic Jun 19, 2024
f27e1bf
fix piece limit tests (regression after Camel feature)
chesslogic Jun 19, 2024
11d683a
Progress toward fixing too-little-material failures.
chesslogic Jun 20, 2024
b876f47
Consistently fix goal reachability.
chesslogic Jun 20, 2024
20d6404
fixes to config and setup for material test fixes
chesslogic Jun 22, 2024
73eb02d
fix pull from world options in material tests
chesslogic Jun 23, 2024
6f300ff
in material tests fix item placement during world setup
chesslogic Jun 26, 2024
47aca88
start eliminating tactics options
chesslogic Jun 26, 2024
15b04a5
create location material for grand chess
chesslogic Jun 26, 2024
e339f3b
id fixes
chesslogic Jun 26, 2024
d7d175f
add a few locations and material requirements. trying to conditionall…
chesslogic Jun 27, 2024
88479c9
fix for locations we didn't want to generate
chesslogic Jun 27, 2024
b09aea1
generation rules only for present locations
chesslogic Jun 28, 2024
860b9c1
remove excess items when fewer locations available
chesslogic Jun 29, 2024
be1d894
check grand material costs
chesslogic Jun 29, 2024
b64b8a3
fix location ids
chesslogic Jun 29, 2024
4cd798e
remove old progression items
chesslogic Jul 2, 2024
36b7605
increase pieces for grand variant
chesslogic Jul 2, 2024
81e12a7
upversion, limit tactics, increase maximum generated pieces
chesslogic Jul 3, 2024
04da7e7
Merge remote-tracking branch 'apmw/main' into checks_mate
chesslogic Jul 3, 2024
5f745d3
remove material options (in favor of Difficulty)
chesslogic Jul 10, 2024
4705091
add comment warning
chesslogic Jul 10, 2024
fe7fa71
remove unnecessary import
chesslogic Jul 10, 2024
bde77e4
test fixes for peer worlds
chesslogic Jul 12, 2024
4ecaf24
idk if the utility needs kwargs
chesslogic Jul 12, 2024
2ef4f08
fix presets, play nice with others
chesslogic Jul 12, 2024
0b98cf3
track material value of play as white
chesslogic Jul 13, 2024
e68feaf
Merge remote-tracking branch 'apmw/main' into checks_mate
chesslogic Jul 13, 2024
4ecd665
Delete tracker.apworld
chesslogic Jul 13, 2024
88b40b8
align option name with new semantic, FCPieces -> FCPieceCollectionCon…
chesslogic Jul 29, 2024
8381ef4
fix cm-ladx test collision
chesslogic Jul 29, 2024
8972515
restyle improper imports
chesslogic Jul 29, 2024
39bfb6d
remove outdated documentation
chesslogic Jul 30, 2024
7f256cc
Finalize pieces option, fix the example players
chesslogic Jul 30, 2024
22b5af4
Add get_filler_item_name
chesslogic Aug 2, 2024
7ab4ab3
Finish renaming fairy chess pieces
chesslogic Aug 2, 2024
94a00e1
Fix preset references to changed option
chesslogic Aug 2, 2024
ba5dfae
Add reference to renamed option in generate_early
chesslogic Aug 2, 2024
88e4e68
Rename option in Rules.py difficulty
chesslogic Aug 2, 2024
24dfb87
Fixes to omit the item link player
chesslogic Aug 2, 2024
38fd757
m: reword why useful items are good
chesslogic Aug 3, 2024
791d435
Merge remote-tracking branch 'apmw/main' into checks_mate
chesslogic Aug 3, 2024
d704298
m: Diffculty->Difficulty
chesslogic Aug 3, 2024
7ceffb6
Merge remote-tracking branch 'apmw/main' into checks_mate
chesslogic Aug 5, 2024
dd87c7f
Remove unrelated items from examples
chesslogic Aug 8, 2024
c518afe
Add 4 new simple Tactics to fill the location gap of Forks.
chesslogic Aug 9, 2024
3bcf488
Small difficulty tweaks to newer locations
chesslogic Aug 9, 2024
e90a88e
Actually exclude forks (can't sleep)
chesslogic Aug 9, 2024
a49040a
incorporate feedback involving relaxed locations
chesslogic Aug 11, 2024
6510d70
2.10
chesslogic Aug 17, 2024
a5ffe61
improve midgame pawn structure difficulty curve
chesslogic Aug 17, 2024
1f3eeff
rescale "of each"
chesslogic Aug 25, 2024
29c2629
lower 4+ series difficulties
chesslogic Sep 22, 2024
d36d2e9
Merge remote-tracking branch 'apmw/main' into checks_mate
chesslogic Sep 28, 2024
191028f
Add Super-Size Me! at the start of Super goal
chesslogic Oct 16, 2024
12b2978
Backport to 3.8
chesslogic Oct 17, 2024
3a88d54
Fix low piece limit infinite hang, pocket limit 0 crash
chesslogic Nov 6, 2024
3a3a052
require version 2.11
chesslogic Nov 6, 2024
ee143c8
Merge branch 'main' into checks_mate
chesslogic Nov 8, 2024
9fccaef
Reflect accessibility fixes in tests
chesslogic Nov 17, 2024
0591cdb
Remove unnecessary minimal from limits test
chesslogic Nov 17, 2024
2b3c96e
Add simple return types
chesslogic Nov 17, 2024
e75da4b
Fix type annotation of child enums
chesslogic Nov 17, 2024
acde41f
Reflect copy(dict) in subclasses
chesslogic Nov 17, 2024
950e0be
Fix test and preset references across files
chesslogic Nov 17, 2024
37a0816
reflect improved limit defaults in limit tests
chesslogic Nov 17, 2024
fa401ac
Update limits tests to locally new options format
chesslogic Nov 17, 2024
f9f0c25
Fix non-minimal accessibility!
chesslogic Nov 17, 2024
eaca8ce
m: Reference army option type instead of '0'
chesslogic Nov 17, 2024
330df29
m: Clarify that disabling Pocket Limit has been supported
chesslogic Nov 17, 2024
a3c6db7
Limit "exceeds max" material per chessmen to bypass "enough yet" only…
chesslogic Nov 17, 2024
61168d7
small update to empty preset
chesslogic Nov 17, 2024
af52db3
Merge branch 'main' into checks_mate
chesslogic Nov 17, 2024
6070d7b
m: Add TODO to resolve comment to use test.bases not WorldTestBase fo…
chesslogic Nov 17, 2024
f268af5
"def setting in CMWorld is dead"
chesslogic Nov 17, 2024
02d2e65
m: remove dead imports
chesslogic Nov 17, 2024
757fe4d
How is create_item_with_correct_settings different from create_item i…
chesslogic Nov 19, 2024
1a14cb9
outdated and unused comments
chesslogic Nov 19, 2024
59dc300
Move some option comments into hidden documentation
chesslogic Nov 19, 2024
d914f97
relative import in tests
chesslogic Nov 19, 2024
0de7ba0
m: extremely minor example yaml tweaks
chesslogic Nov 19, 2024
1a19189
remove dated code and docs
chesslogic Nov 19, 2024
5fd05a4
Initial Review/Lookthrough (#1)
Exempt-Medic Nov 19, 2024
de9de42
partial conversion to use self=cmworld in rules
chesslogic Nov 20, 2024
1ef3be1
refactor set_rules to self
chesslogic Nov 21, 2024
bdae597
early len in difficulty
chesslogic Nov 21, 2024
77e45ba
fix order of cast()
chesslogic Nov 22, 2024
2b365b3
remove criticism of progression balancing
chesslogic Nov 22, 2024
689005e
Merge branch 'main' of https://github.com/ArchipelagoMW/Archipelago i…
chesslogic Nov 22, 2024
18538dd
replace self with world in non class method
chesslogic Nov 22, 2024
43cb363
Merge branch 'main' into checks_mate
chesslogic Dec 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
# ChecksFinder
/worlds/checksfinder/ @jonloveslegos

# ChecksMate Chess
/worlds/checksmate/ @chesslogic

# Clique
/worlds/clique/ @ThePhar

Expand Down
105 changes: 105 additions & 0 deletions worlds/checksmate/Items.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import math
from typing import Dict, NamedTuple, Optional

from BaseClasses import Item, ItemClassification


class CMItem(Item):
game: str = "ChecksMate"


class CMItemData(NamedTuple):
code: Optional[int]
classification: ItemClassification
quantity: float = 1 # maximum, not guaranteed
material: int = 0 # pawns=2, minor=6, major=10, queen=18 - doubled to account for 0.5 values
parents: list[str] = None


item_table = {
"Play as White": CMItemData(4_901_000, ItemClassification.progression, material=50),
"Progressive Engine ELO Lobotomy": CMItemData(4_901_001, ItemClassification.useful, quantity=5),
# TODO: stop counting material if the board fills up with 23 pieces+pawns
"Progressive Pawn": CMItemData(4_901_002, ItemClassification.progression, quantity=14, material=100),
"Progressive Pawn Forwardness": CMItemData(4_901_003, ItemClassification.filler, quantity=4, parents=["Progressive Pawn"]),
# Bishops and Knights are worth 3.25 to 3.5, but some minor pieces are worse, so we assume 3.0 conservatively
"Progressive Minor Piece": CMItemData(4_901_004, ItemClassification.progression, quantity=9, material=300),
# Rooks are worth 5.25 to 5.5, but many major pieces are worse, so we assume 4.85, which stays under 5.0
"Progressive Major Piece": CMItemData(4_901_005, ItemClassification.progression, quantity=9, material=485),
# Queen pieces are pretty good, and even the weak ones are pretty close, so queens can stay 9.0 (but not 10.0)
"Progressive Major To Queen": CMItemData(4_901_006, ItemClassification.progression, quantity=5, material=415,
parents=["Progressive Major Piece"]),
"Victory": CMItemData(4_901_009, ItemClassification.progression),
# TODO: implement extra moves
# "Progressive Enemy Pawn": CMItemData(4_907, ItemClassification.trap, quantity=8),
# "Progressive Enemy Piece": CMItemData(4_908, ItemClassification.trap, quantity=7),
# "Progressive Opening Move": CMItemData(4_010, ItemClassification.useful, quantity=3),

# Players have 3 pockets, which can be empty, or hold a pawn, minor piece, major piece, or queen.
# Collected pocket items are distributed randomly to the 3 pockets in the above order.
# Pocket pawns are playable onto home row instead of making a move
# Pocket pieces start as minor pieces (e.g. Knight) - they upgrade in both Gem cost and type
# Piece upgrades turn minor pieces into major pieces or major pieces into Queen - implementation may decide
"Progressive Pocket": CMItemData(4_901_020, ItemClassification.progression, quantity=12, material=100),

# Gems are a way to generate filler items and limit use of Pocket items
# Gems are generated 1/turn and Pocket pieces cost 1 Gem per their material value
# Turn off Pocket entirely to hide this item. Also you can't or generation will fail EleGiggle
# WARNING: Do not set all your filler items to local_only or generation will fail
"Progressive Pocket Gems": CMItemData(4_901_023, ItemClassification.filler, quantity=math.inf),
# Allows the player to deploy pocket items one rank further from the home row, but not the opponent's home row
# WARNING: Do not set all your filler items to local_only or generation will fail
"Progressive Pocket Range": CMItemData(4_901_024, ItemClassification.filler, quantity=6),

"Progressive King Promotion": CMItemData(4_901_025, ItemClassification.progression, quantity=2, material=300),
"Progressive Consul": CMItemData(4_901_026, ItemClassification.progression, quantity=2, material=300),

"Enemy Pawn A": CMItemData(4_901_030, ItemClassification.progression),
"Enemy Pawn B": CMItemData(4_901_031, ItemClassification.progression),
"Enemy Pawn C": CMItemData(4_901_032, ItemClassification.progression),
"Enemy Pawn D": CMItemData(4_901_033, ItemClassification.progression),
"Enemy Pawn E": CMItemData(4_901_034, ItemClassification.progression),
"Enemy Pawn F": CMItemData(4_901_035, ItemClassification.progression),
"Enemy Pawn G": CMItemData(4_901_036, ItemClassification.progression),
"Enemy Pawn H": CMItemData(4_901_037, ItemClassification.progression),
"Enemy Piece A": CMItemData(4_901_038, ItemClassification.progression),
"Enemy Piece B": CMItemData(4_901_039, ItemClassification.progression),
"Enemy Piece C": CMItemData(4_901_040, ItemClassification.progression),
"Enemy Piece D": CMItemData(4_901_041, ItemClassification.progression),
"Enemy Piece F": CMItemData(4_901_042, ItemClassification.progression),
"Enemy Piece G": CMItemData(4_901_043, ItemClassification.progression),
"Enemy Piece H": CMItemData(4_901_044, ItemClassification.progression),
# TODO: implement castling rule & guarantee major piece on that side for Locations
# "Play 00 Castle": CMItemData(4_010, ItemClassification.progression),
# "Play 000 Castle": CMItemData(4_011, ItemClassification.progression),
# TODO: consider breaking passant into individual pawns, or progressive for outer..center pawns
# "Play En Passant": CMItemData(4_012, ItemClassification.progression),

# == Possible pocket implementation ==
# "Progressive Pocket Pawn": CMItemData(4_021, ItemClassification.progression, quantity=3, material=90),
# "Progressive Pocket Pawn to Piece": CMItemData(4_022, ItemClassification.progression, quantity=3, material=190,
# parents=["Progressive Pocket Pawn"]),
# "Progressive Pocket Piece Promotion": parents=["Progressive Pocket Pawn to Piece",
# "Progressive Pocket Pawn"]),
# == End possible pocket implementation ==
}

lookup_id_to_name: Dict[int, str] = {data.code: item_name for item_name, data in item_table.items() if data.code}


material_items: Dict[str, CMItemData] = {
item: item_data for (item, item_data) in item_table.items() if item_data.material > 0}
progression_items: Dict[str, CMItemData] = {
item: item_data for (item, item_data) in item_table.items() if item_data.classification == ItemClassification.progression}
useful_items: Dict[str, CMItemData] = {
item: item_data for (item, item_data) in item_table.items() if item_data.classification == ItemClassification.useful}
filler_items: Dict[str, CMItemData] = {
item: item_data for (item, item_data) in item_table.items() if item_data.classification == ItemClassification.filler}


def create_item_with_correct_settings(player: int, name: str) -> Item:
chesslogic marked this conversation as resolved.
Show resolved Hide resolved
data = item_table[name]

item = Item(name, data.classification, data.code, player)

return item
102 changes: 102 additions & 0 deletions worlds/checksmate/Locations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
from typing import Dict, NamedTuple, Optional

from BaseClasses import Location


class CMLocation(Location):
game: str = "ChecksMate"


class CMLocationData(NamedTuple):
code: Optional[int]
capture: bool
difficult: bool


location_table = {
# capture individual pieces and pawns
"Capture Pawn A": CMLocationData(4_902_000, True, False),
"Capture Pawn B": CMLocationData(4_902_001, True, False),
"Capture Pawn C": CMLocationData(4_902_002, True, False),
"Capture Pawn D": CMLocationData(4_902_003, True, False),
"Capture Pawn E": CMLocationData(4_902_004, True, False),
"Capture Pawn F": CMLocationData(4_902_005, True, False),
"Capture Pawn G": CMLocationData(4_902_006, True, False),
"Capture Pawn H": CMLocationData(4_902_007, True, False),
"Capture Piece A": CMLocationData(4_902_008, True, False),
"Capture Piece B": CMLocationData(4_902_010, True, False),
"Capture Piece C": CMLocationData(4_902_012, True, False),
"Capture Piece D": CMLocationData(4_902_014, True, False),
"Capture Piece F": CMLocationData(4_902_013, True, False),
"Capture Piece G": CMLocationData(4_902_011, True, False),
"Capture Piece H": CMLocationData(4_902_009, True, False),
# some first locations
# for strategic analysis see: https://en.wikipedia.org/wiki/Bongcloud_Attack
"Bongcloud Once": CMLocationData(4_902_015, True, False),
"Bongcloud Center": CMLocationData(4_902_016, True, False),
"Bongcloud A File": CMLocationData(4_902_017, True, False),
"Bongcloud Capture": CMLocationData(4_902_018, True, False),
"Bongcloud Promotion": CMLocationData(4_902_019, True, False),
# capture series of pieces and pawns within 1 game
"Capture 2 Pawns": CMLocationData(4_902_020, True, False),
"Capture 3 Pawns": CMLocationData(4_902_021, True, False),
"Capture 4 Pawns": CMLocationData(4_902_022, True, False),
"Capture 5 Pawns": CMLocationData(4_902_023, True, False),
"Capture 6 Pawns": CMLocationData(4_902_024, True, False),
"Capture 7 Pawns": CMLocationData(4_902_025, True, False),
"Capture 8 Pawns": CMLocationData(4_902_026, True, False),
"Capture 2 Pieces": CMLocationData(4_902_027, True, False),
"Capture 3 Pieces": CMLocationData(4_902_028, True, False),
"Capture 4 Pieces": CMLocationData(4_902_029, True, False),
"Capture 5 Pieces": CMLocationData(4_902_030, True, False),
"Capture 6 Pieces": CMLocationData(4_902_031, True, False),
"Capture 7 Pieces": CMLocationData(4_902_032, True, False),
"Capture 2 Of Each": CMLocationData(4_902_033, True, False),
"Capture 3 Of Each": CMLocationData(4_902_034, True, False),
"Capture 4 Of Each": CMLocationData(4_902_035, True, False),
"Capture 5 Of Each": CMLocationData(4_902_036, True, False),
"Capture 6 Of Each": CMLocationData(4_902_037, True, False),
"Capture 7 Of Each": CMLocationData(4_902_038, True, False),
"Capture Everything": CMLocationData(4_902_039, True, False),
"Threaten Pawn": CMLocationData(4_902_040, True, False),
"Threaten Minor": CMLocationData(4_902_041, True, False),
"Threaten Major": CMLocationData(4_902_042, True, False),
"Threaten Queen": CMLocationData(4_902_043, True, False),
"Threaten King": CMLocationData(4_902_044, True, False),
# special moves and tactics
# TODO: Getting a french move on the AI seems nigh impossible - maybe I can tweak the evaluation or something
# "French Move": CMLocationData(4_902_050, True, False),
# "Discovered Attack": CMLocationData(4_902_051, True, False),
"Fork, Sacrificial": CMLocationData(4_902_052, True, False),
"Fork, Sacrificial Triple": CMLocationData(4_902_053, True, False),
"Fork, Sacrificial Royal": CMLocationData(4_902_054, True, True),
"Fork, True": CMLocationData(4_902_055, True, False),
"Fork, True Triple": CMLocationData(4_902_056, True, False),
"Fork, True Royal": CMLocationData(4_902_057, True, True),
# TODO: prevent castle from holding enemy pieces (progression item) in case of "Oops all queens."
"O-O Castle": CMLocationData(4_902_058, True, False),
"O-O-O Castle": CMLocationData(4_902_059, True, False),
# "Discovered Attack": CMLocationData(4_902_060, True, False),
# "Pin": CMLocationData(4_902_061, True, False),
# "Skewer": CMLocationData(4_902_062, True, False),
# goal 1+ requires that you successively checkmate your opponent as they gain material
# "Checkmate Minima": CMLocationData(4_902_084, True, False),
# "Checkmate One Piece": CMLocationData(4_902_085, True, False),
# "Checkmate 2 Pieces": CMLocationData(4_902_086, True, False),
# "Checkmate 3 Pieces": CMLocationData(4_902_087, True, False),
# "Checkmate 4 Pieces": CMLocationData(4_902_088, True, False),
# "Checkmate 5 Pieces": CMLocationData(4_902_089, True, False),
# "Checkmate 6 Pieces": CMLocationData(4_902_090, True, False),
# "Checkmate 7 Pieces": CMLocationData(4_902_091, True, False),
# "Checkmate 8 Pieces": CMLocationData(4_902_092, True, False),
# "Checkmate 9 Pieces": CMLocationData(4_902_093, True, False),
# "Checkmate 10 Pieces": CMLocationData(4_902_094, True, False),
# "Checkmate 11 Pieces": CMLocationData(4_902_095, True, False),
# "Checkmate 12 Pieces": CMLocationData(4_902_096, True, False),
# "Checkmate 13 Pieces": CMLocationData(4_902_097, True, False),
# "Checkmate 14 Pieces": CMLocationData(4_902_098, True, False),
"Checkmate Maxima": CMLocationData(4_902_099, True, False),

}

lookup_id_to_name: Dict[int, str] = {data.code: item_name for item_name, data in location_table.items() if data.code}
Loading