gthc 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cdda8bbf24bf57f441c14c0c610014e2b1e19baeb6b9d3029e1f053bef3c90b9
4
- data.tar.gz: 68c61801bf40ccd882e9d436e57bf77aac0710884f6b415114825537e4288094
3
+ metadata.gz: b43241f23f222376f99df65b0584ef0eb6d7490a2c2f0c41411f0abe2a347b41
4
+ data.tar.gz: 36585ccfc6a5270eacab88728d04ff8dbbbae391dc9082cb9b73ab6b46e3976f
5
5
  SHA512:
6
- metadata.gz: '09bdf3433f89b186b224aa8b33614f5a28f219198e611c4823272cd1da04752f887e2f7f2d3373bb2411af72c46411947bfc0094fb696cb1ae5626c9b5cdce42'
7
- data.tar.gz: 1b66da20c59d9d2bdea94553e645929ecfa023fed7715ea33569f383c3f43bfa1ce0eda27c90d495f93c0478fdb2fd2bd026d5e170342e28a482f01613b38021
6
+ metadata.gz: 88f1acc5a41ebd711dce9cb21dd4b971ad653b7ec33eac25b9d69b6b81c7f0a6bc29b156c861993623de418a1eaaff865fdd99ab41f4044feed0cdf9f9290293
7
+ data.tar.gz: 50402622cf5948c50ca2d25a67953a8358ee44b2dae4b690151ad5ab2398498956008109150ab78d35314ef27683f9e997546631f167fce5541ba92fc30ae803
@@ -23,13 +23,14 @@ module Algorithm
23
23
  people, slots = Weight.weightBalance(people, slots)
24
24
 
25
25
  # Weight Contiguous - prioritize people to stay in the tent more time at once.
26
- slots, scheduleGrid = Weight.weightContiguous(slots, scheduleGrid, people)
26
+ slots, scheduleGrid = Weight.weightContiguous(slots, scheduleGrid)
27
27
 
28
28
  # Weight Tough Time - prioritize time slots with few people available.
29
29
  slots = Weight.weightToughTime(slots, scheduleLength)
30
30
 
31
31
  # Sort by Weights
32
- slots.sort_by { |a| -a.weight }
32
+ slots.sort! { |a, b| b.weight <=> a.weight }
33
+ # pp slots
33
34
 
34
35
  # Update people, spreadsheet, and remove slots.
35
36
  people, slots, graveyard, scheduleGrid = Weight.weightPick(people, slots, graveyard, scheduleGrid)
@@ -22,20 +22,16 @@ module Weight
22
22
  nightScheduled = people[currentPersonID].nightScheduled
23
23
  night = currentSlot.isNight;
24
24
 
25
- nightMulti = 0;
26
- dayMulti = 0;
25
+ nightMulti = 1;
26
+ dayMulti = 1;
27
27
 
28
28
  # Set multipliers.
29
29
  if nightScheduled != 0
30
- nightMulti = 1.0 / nightScheduled
31
- else
32
- nightMulti = 1.5
30
+ nightMulti = 1.0 / (nightScheduled + 1)
33
31
  end
34
32
 
35
33
  if dayScheduled != 0
36
- dayMulti = (1.0/(dayScheduled+nightScheduled*4*2))
37
- else
38
- dayMulti = 1.5
34
+ dayMulti = 1.0 / (dayScheduled + 1)
39
35
  end
40
36
 
41
37
  #Adjust weights with multipliers.
@@ -55,7 +51,7 @@ module Weight
55
51
  end
56
52
 
57
53
  # Weight Contiguous - prioritize people to stay in the tent more time at once.
58
- def self.weightContiguous(slots, scheduleGrid, people)
54
+ def self.weightContiguous(slots, scheduleGrid)
59
55
 
60
56
  i = 0
61
57
  while i < slots.length
@@ -94,9 +90,7 @@ module Weight
94
90
 
95
91
  # Both are not free
96
92
  if !belowTent && !belowFree && !aboveSome && !belowSome && !aboveTent && !aboveFree
97
- if slots[i].weight > 0
98
- multi = -1
99
- end
93
+ multi *= 0.25
100
94
  end
101
95
 
102
96
  # Above is scheduled, below is free.
@@ -140,18 +134,10 @@ module Weight
140
134
  end
141
135
 
142
136
  # Occurance of Somewhat Available
143
- if aboveSome || belowSome
137
+ if slots[i].status == "Somewhat"
144
138
  multi *= 0.5
145
139
  end
146
140
 
147
- # multi based on person
148
- person = people[slots[i].col]
149
- if slots[i].isNight && person.nightScheduled > 0
150
- multi *= (1/person.nightScheduled)
151
- elsif person.dayScheduled > 0
152
- multi *= (1/person.dayScheduled)
153
- end
154
-
155
141
  slots[i].weight = slots[i].weight*multi
156
142
  i += 1
157
143
 
@@ -1,3 +1,3 @@
1
1
  module GTHC
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gthc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aman Ibrahim
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-12-19 00:00:00.000000000 Z
12
+ date: 2019-12-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler