Skip to content

Commit f3e57be

Browse files
committed
Full map
1 parent 268f354 commit f3e57be

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

fortran/solver/src/solution.f90

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,15 @@ end function connection_t_not_equal
6969
function solution_t_to_json(solution) result(json)
7070
class(solution_t), intent(in) :: solution
7171
character(len=:), allocatable :: json
72+
character(len=4) :: tmp
7273
integer :: i
73-
json = '"startingRoom": 1, "connections": [ '
74+
json = '"map": { "rooms": [ '
75+
do i = 1, size(solution%connections) / 6
76+
write(tmp, '(I0)') mod(i-1, 4)
77+
json = json // trim(tmp)
78+
if (i /= size(solution%connections) / 6) json = json // ', '
79+
end do
80+
json = json // ' ], "startingRoom": 1, "connections": [ '
7481
do i = 1, size(solution%connections)
7582
json = json // solution%connections(i)%to_json()
7683
if (i /= size(solution%connections)) json = json // ', '

0 commit comments

Comments
 (0)