Skip to content

Commit

Permalink
Scoring: code style fixes and optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Jul 8, 2023
1 parent e21500b commit 3ffcc22
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Icfpc2023/Scoring.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let private CalculateAttendeeMusicianScore (attendee: Attendee) (musician: Music
ceil(1_000_000.0 * attendee.Tastes[musician.Instrument] / d_squared)

let private AnyOtherMusicianBlocksSound (musicians: Musician[]) (attendee: Attendee) (mIndex: int): bool =
let musician = PointD(musicians.[mIndex].Location.X, musicians.[mIndex].Location.Y)
let musician = PointD(musicians[mIndex].Location.X, musicians[mIndex].Location.Y)
let attendee = PointD(attendee.X, attendee.Y)
let blockZone = { Center1 = musician; Center2 = attendee; Radius = 5.0 }

Expand All @@ -27,14 +27,14 @@ let private CalculateAttendeeScore (musicians: Musician[]) (attendee: Attendee):
)

let private CalculateAttendeeNoBlockingScore (musicians: Musician[]) (attendee: Attendee): Score =
Seq.indexed musicians
|> Seq.sumBy(fun (i, musician) ->
musicians
|> Array.sumBy(fun musician ->
CalculateAttendeeMusicianScore attendee musician
)

let private CalculateMusicianNoBlockingScore (attendees: Attendee[]) (musician: Musician): Score =
Seq.indexed attendees
|> Seq.sumBy(fun (i, attendee) ->
attendees
|> Array.sumBy(fun attendee ->
CalculateAttendeeMusicianScore attendee musician
)

Expand Down

0 comments on commit 3ffcc22

Please sign in to comment.