Skip to content

Massively overhauled Cell, updated square_map() to be compatible and more efficient

Saris, J.S. (Joep) requested to merge bro into main

Cell changed from Cell(cell_info, car, coordinates), with cell_info representing an int that is -1: inaccessible, 0: normal_road, 1: northeast road, 2: southwest road, 3: potential start point, 4: potential destination. Messy representation, to the new Cell(coordinates, type, heading_direction, lane, car), with coords: tuple # (Y, X) coordinates of cell in Map cell_type: int # -1: inaccessible, 0: road, 1: entry_cell, 2: exit_cell heading_direction: int # -1: none, 0: down, 1: left, 2: up, 3: right lane: int # Used to declare relative switching/turning directions, -1: solo_lane (= no lane switching), 0: middle_lane (= switching left and right), 1: left_border_lane (= switching right), 2: right_border_lane (= switching left) car: NonJAX_Car # Car object if occupied, otherwise None -> NonJax_Car because I don't yet know how to make complex Jax agents, for testing purposes I have a NonJax_Car that I can iteratively define and move across Map().

With these changes to Cell, the interpretation of find_route() and logic() also need to be updated, as they were made for the messy representation and used some 'dirty tricks' when it came to turning directions. In my next push you will probably see the find_route and logic functions updated.

Merge request reports

Loading