+ 2

Code breaks when running

This code crashes / exits out when running. I suspect a vector out-of-bounds logical error. Can you guys help me fix it? ( Well if you have a SFML compiler ofc ) https://sololearn.com/compiler-playground/cNXx0QIpQ4R6/?ref=app

24th Jun 2024, 2:55 PM
WalterXD
WalterXD - avatar
1 Antwort
0
Nvm I found out why; I needed to initialize the vectors: std::vector<std::vector<int>> lifeT(TRAIL_LENGTH); std::vector<sf::Vector2f> vel(NUM_OF_SNAKES); And std::vector<std::vector<sf::Vector2f>> rPos(NUM_OF_SNAKES);
24th Jun 2024, 7:39 PM
WalterXD
WalterXD - avatar