Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 3 additions & 19 deletions players/player_4/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,8 @@ def _coherence_prev3_score(self, item: Item, history: list[Item | None]) -> floa
"""
Coherence over the previous up to 3 non-pause items:
- Hot-streak penalty: if any subject in `item` appears in *each* of the last 3 -> -1.0
- Otherwise, reward based on total matched frequency across prev-3:
- Otherwise, reward based on total matched frequency across prev-3 for each subject:
sum_match/len(item.subjects)
sum_match >= 4 -> +1.5 (e.g., 2+2)
sum_match == 3 -> +1.0 (e.g., 2+1)
sum_match == 2 -> +0.5
sum_match == 1 -> +0.25
else -> 0.0
The window does not cross pauses.
"""
prev3 = self._take_preceding_block(history, 3)
Expand All @@ -93,15 +88,6 @@ def _coherence_prev3_score(self, item: Item, history: list[Item | None]) -> floa
common_all3 = sets[0] & sets[1] & sets[2]
if any(s in common_all3 for s in item.subjects):
return -1.0
"""if sum_match >= 4:
elif sum_match == 3:
return 1.0
elif sum_match == 2:
return 0.5
elif sum_match == 1:
return 0.25
else:
return 0.0"""
# Count subject frequencies across prev-3
counts = Counter()
for it in prev3:
Expand Down Expand Up @@ -200,9 +186,7 @@ def propose_item(self, history: list[Item | None]) -> Item | None:
if not scored:
return None
best_score = max(s for s, _ in scored)
# print(best_score)
# print(history)
# max_possible = 1.0 + 2.0 + 1.5 # importance + pause + coherence

threshold = 1
if len(history) != 0 and best_score < threshold:
return None
Expand All @@ -212,6 +196,6 @@ def propose_item(self, history: list[Item | None]) -> Item | None:

choice = tied[0] if len(tied) == 1 else min(tied, key=self._preference_tiebreak_key)

# Track contribution if you care downstream
# Track contribution
self.contributed_items.append(choice)
return choice