side-project-at-SPT / split-rails

game split implemented by rails
0 stars 1 forks source link

地圖產生有機率發生pasture重疊 #7

Closed tom00502 closed 3 months ago

tom00502 commented 3 months ago

pasture座標重疊導致異常

之前發生企鵝消失事件 原來是有企鵝進入了平行世界

產生了兩塊同樣為(5,6)的地圖 Image

rander出來可以發現地圖只有31塊 Image

原來躲在後面 Image

參考

gameId: 204
gameData: 
{
    "event": "stack_placed",
    "game_config": {
        "players_number": 2,
        "players": [
            {
                "id": 11,
                "nickname": "Tux",
                "color": "red",
                "character": "gunter"
            },
            {
                "id": 15,
                "nickname": "小乖",
                "color": "blue",
                "character": "tux"
            }
        ]
    },
    "game_data": {
        "step": 3,
        "current_player_index": 1,
        "phase": "split_stack",
        "pastures": [
            {
                "x": 5,
                "y": 6,
                "is_blocked": false,
                "stack": {
                    "color": "red",
                    "amount": 16
                }
            },
            {
                "x": 5,
                "y": 7,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 4,
                "y": 8,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 6,
                "y": 7,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 5,
                "y": 6,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 6,
                "y": 5,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 3,
                "y": 9,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 5,
                "y": 8,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 3,
                "y": 10,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 7,
                "y": 4,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 6,
                "y": 4,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 7,
                "y": 3,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 6,
                "y": 6,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 2,
                "y": 9,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 3,
                "y": 8,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 6,
                "y": 8,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 1,
                "y": 10,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 0,
                "y": 10,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 7,
                "y": 2,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 7,
                "y": 6,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 6,
                "y": 3,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 8,
                "y": 1,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 2,
                "y": 10,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 8,
                "y": 3,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 9,
                "y": 1,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 4,
                "y": 10,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 9,
                "y": 0,
                "is_blocked": false,
                "stack": {
                    "color": "blue",
                    "amount": 16
                }
            },
            {
                "x": 8,
                "y": 6,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 7,
                "y": 7,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 1,
                "y": 9,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 6,
                "y": 2,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            },
            {
                "x": 5,
                "y": 9,
                "is_blocked": false,
                "stack": {
                    "color": "blank",
                    "amount": 0
                }
            }
        ]
    },
    "action": {
        "author": "red",
        "action_name": "place_stack",
        "to_grid": {
            "x": 5,
            "y": 6,
            "stack": {
                "color": "red",
                "amount": 16
            }
        }
    }
}

期望

產生地圖時座標不要重疊

noracami commented 3 months ago

@tom00502 ready to review