YetAnotherSpieskowcy / Carcassonne-Engine

Other
0 stars 1 forks source link

Field instance cannot expand to another feature on the checked tile, if it's not on the board #86

Closed Jackenmen closed 1 day ago

Jackenmen commented 1 week ago

Description

This TODO needs to be addressed: https://github.com/YetAnotherSpieskowcy/Carcassonne-Engine/blob/a711a81f37b51efd849b63710c001a60ab8971fb/pkg/game/board.go#L240-L243

Graphical example

image

Regression test

Already present in the affected branch (#62), you'll just need to remove the t.Skip to have it run: https://github.com/YetAnotherSpieskowcy/Carcassonne-Engine/blob/a711a81f37b51efd849b63710c001a60ab8971fb/pkg/game/board_test.go#L137-L177

Test output

$ go test -count=1 ./pkg/game -run TestBoardFieldCanBePlacedReturnsFalseWhenExpandToFieldWithMeepleHappensOverAnotherField
--- FAIL: TestBoardFieldCanBePlacedReturnsFalseWhenExpandToFieldWithMeepleHappensOverAnotherField (0.00s)
    board_test.go:173: expected false, got true instead
FAIL
FAIL    github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game 0.002s
FAIL
Lenetis commented 1 week ago

Note: to correctly reproduce the issue, the line 146 in regression test should be changed:

- ptile.GetPlacedFeatureAtSide(side.Bottom, feature.City).Meeple = elements.Meeple{
+ ptile.GetPlacedFeatureAtSide(side.Top, feature.Field).Meeple = elements.Meeple{