mirror of
https://github.com/lscharen/iigs-sprite-compiler.git
synced 2024-06-06 12:29:32 +00:00
25 lines
501 B
C#
25 lines
501 B
C#
namespace SpriteCompiler.AI
|
|
{
|
|
using System;
|
|
|
|
public static class CostExtensions
|
|
{
|
|
public static C Max<C>(this C left, C right) where C : ICost<C>
|
|
{
|
|
return (left.CompareTo(right) >= 0)
|
|
? left
|
|
: right;
|
|
}
|
|
}
|
|
|
|
public interface ICost<C> : IComparable<C>
|
|
{
|
|
C Add(C value);
|
|
|
|
// Number theoretic values, i.e. C + ZERO = C, C * ONE = C
|
|
C Zero();
|
|
C One();
|
|
C Maximum();
|
|
}
|
|
}
|