Skip to content

Commit

Permalink
Show progress
Browse files Browse the repository at this point in the history
  • Loading branch information
foxtran committed Jul 9, 2023
1 parent 1fade16 commit b1e4599
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions icfpc2023.Fortran/src/guess.f90
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ subroutine guess_v2(room)
end do
musician%volume = 1._8
do instr = 1, room%N_instruments
write(6, "(A,I0,A,I0,A)", advance="no") "Layer ", instr, " of ", room%N_instruments, repeat(" ", 20) // char(13)
flush(6)
musician%instrument = instr
do i = 1, size(grid(instr)%skip)
musician%pos = grid(instr)%pos(i)
Expand All @@ -93,6 +95,8 @@ subroutine guess_v2(room)
end do
end do
do layer = 1, room%N_instruments
write(6, "(A,I0,A,I0,A)", advance="no") "Layer ", layer, " of ", room%N_instruments, repeat(" ", 20) // char(13)
flush(6)
max_pos = maxloc(grid(layer)%value)
call additional%generate_grid(max(minx, grid(layer)%pos(max_pos(1))%x - 10._8), &
min(maxx, grid(layer)%pos(max_pos(1))%x + 10._8), &
Expand Down
4 changes: 2 additions & 2 deletions icfpc2023.Fortran/src/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ program main
call room%load(filename)
call room%print()
e1 = room%score()
print *, "Old: ", e1
call guess_v2(room)
e2 = room%score()
print *, "Old: ", e1
print *, "New: ", e2
print "(A,F15.2,A,F8.2,A)", "Improvement: ", e2-e1, "; ", (e2-e1)/abs(e1)*100, "%"
if (e2 > e1 .or. .true.) then
if (e2 > e1) then
call room%dump(trim(filename)//".new", "FoxtranForV2")
end if
end program main

0 comments on commit b1e4599

Please sign in to comment.