Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Commit

Permalink
Difficulty preference slider now affects 3 unaccessable settings prop…
Browse files Browse the repository at this point in the history
…erties which affect how many and how difficult are the suggestions returned. This makes the results more or less even in all states of the slider.
  • Loading branch information
Tyrrrz committed Aug 23, 2016
1 parent 3e2bcf1 commit 0cd05e5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
37 changes: 27 additions & 10 deletions OsuHelper/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ static Settings()

private bool _preferNoVideo;
private bool _onlyFullCombo = true;
private int _ownPlayCountToScan = 20;
private int _othersPlayCountToScan = 5;
private int _similarPlayCount = 5;
private double _difficultyPreference = 0.5;
private int _ownPlayCountToScan;
private int _othersPlayCountToScan;
private int _similarPlayCount;
private int _recommendationCount = 200;

public string UserID
Expand Down Expand Up @@ -70,22 +71,35 @@ public bool OnlyFullCombo
set { Set(ref _onlyFullCombo, value); }
}

public double DifficultyPreference
{
get { return _difficultyPreference; }
set
{
Set(ref _difficultyPreference, value);
UpdateDifficultyPreference();
}
}

[JsonIgnore]
public int OwnPlayCountToScan
{
get { return _ownPlayCountToScan; }
set { Set(ref _ownPlayCountToScan, value); }
private set { Set(ref _ownPlayCountToScan, value); }
}

[JsonIgnore]
public int OthersPlayCountToScan
{
get { return _othersPlayCountToScan; }
set { Set(ref _othersPlayCountToScan, value); }
private set { Set(ref _othersPlayCountToScan, value); }
}

[JsonIgnore]
public int SimilarPlayCount
{
get { return _similarPlayCount; }
set { Set(ref _similarPlayCount, value); }
private set { Set(ref _similarPlayCount, value); }
}

public int RecommendationCount
Expand All @@ -94,11 +108,14 @@ public int RecommendationCount
set { Set(ref _recommendationCount, value); }
}

[JsonIgnore]
public double DifficultyPreference
private void UpdateDifficultyPreference()
{
get { return 1.0 - OwnPlayCountToScan/100.0; }
set { OwnPlayCountToScan = (int) (100.0*(1.0 - value)); }
// 0 -> easy maps, 1 -> hard maps
// 0 -> own play count = 35, others play count = 5, similar play count = 5
// 1 -> own play count = 5, others play count = 20, similar play count = 20
OwnPlayCountToScan = (int) (5 + ((1 - DifficultyPreference)*30));
OthersPlayCountToScan = (int) (20 - ((1 - DifficultyPreference)*15));
SimilarPlayCount = (int) (20 - ((1 - DifficultyPreference)*15));
}

public Settings()
Expand Down
2 changes: 1 addition & 1 deletion OsuHelper/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
IsChecked="{Binding StagingSettings.OnlyFullCombo}" />
<TextBlock Margin="5" Text="Difficulty preference (left - easier maps, less PP; right - harder maps, more pp):" />
<Slider LargeChange="0.25"
Maximum="0.99"
Maximum="1"
Minimum="0"
SmallChange="0.1"
Value="{Binding StagingSettings.DifficultyPreference}" />
Expand Down

0 comments on commit 0cd05e5

Please sign in to comment.