Created
February 20, 2017 18:42
-
-
Save Kikimora/82ed79cb28ed96039108f8eb58869273 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Booster : IBooster | |
{ | |
public int Multiplier {get; set;} | |
public SelfieConfig [] Applies { get; set; } | |
public void Apply(IPoly poly){ | |
foreach (var monomial in poly) { | |
var selfie = monomial.Info as Selfie; | |
if (selfie != null && Applies.Contains(selfie.Config)) { | |
monomial.Multiply(Multiplier); | |
} | |
} | |
} | |
} | |
public class RatingConfig : ScriptableObject { | |
public int Value { get; set; } | |
} | |
public class SelfieConfig : ScriptableObject { | |
public RatingConfig[] Ratings { get; set; } | |
} | |
public class Rating { | |
public RatingConfig Config { get; set; } | |
public DateTime Start { get; set; } | |
} | |
public class Selfie { | |
public HastTags HashTags { get; set; } | |
public List<Rating> Ratings { get; } = new List<Rating>(); | |
public SelfieConfig Config { get; set; } | |
public Poly Poly { | |
get { | |
var poly = Poly.Constant(Rating.Value); | |
poly.Info = this; | |
if (HashTags != null) { | |
poly.Multiply(HashTags.Value); | |
} | |
var ratingPoly = new Poly(); | |
foreach (var r in Ratings) { | |
ratingPoly.Add(r.Value); | |
} | |
poly.Multiply(ratingPoly); | |
return poly; | |
} | |
} | |
} | |
public class Player { | |
public List<Selfie> selfies; | |
public List<IBooster> boosters; | |
public List<Friend> friends; | |
public int FollowersAt(DateTime t0){ | |
var poly = new Poly(); | |
foreach (var s in selfies) { | |
poly.Add(s.Poly); | |
} | |
foreach (var b in boosters) { | |
b.Apply(poly); | |
} | |
return poly.ValueAt(t0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment