This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
public static class U { | |
// Math | |
public static double PercentOf(this double value, double ofWhat) { | |
return ofWhat * value / 100; |
This file contains 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
using System; | |
public static class ExtensionUtils { | |
public static float DistanceTo(this (float, float) pointA, (float, float) pointB) { | |
var (ax, ay) = pointA; | |
var (bx, by) = pointB; | |
return (float) Math.Sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by)); | |
} |
This file contains 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
// Online C# Editor for free | |
// Write, Edit and Run your C# code using C# Online Compiler | |
using System; | |
using System.Linq; | |
public class HPoint { | |
public float X; | |
public float Y; | |
This file contains 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
/* | |
Use like: | |
float[] eloChanges = EloSystem.CalculateEloChanges(playerElos: new float[] { 14000, 4500, 11000, 17444, 6969, 21000 }, winnerIndex: 1, eloStakes: 100, isDebug: true); | |
float[][] teamsEloChanges1 = EloSystem.CalculateTeamsEloChanges(teamsWithPlayerElos: new[] { team1, team2, team3 }, winnerIndex: 1, eloStakes: 100, isDebug: true); | |
float[][] teamsEloChanges2 = EloSystem.CalculateTeamsEloChanges(teamsWithPlayerElos: new float[][] { | |
new float[] { 14000, 4500 }, | |
new float[] { 11000, 17444 }, | |
new float[] { 6969, 21000 }, | |
}, winnerIndex: 1, eloStakes: 100, isDebug: true); |
This file contains 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
// Run with `groovy caesars-casino.groovy` | |
// (c) 2011 Playtika | |
// This code is licensed under MIT license (see LICENSE.txt) | |
import java.util.Collections; | |
class CaesarsCasino { | |
static void main(String[] args) { | |
def symbolsOnLine = "\$@#7?" | |
def machine = new Machine(symbolsOnLine) |
This file contains 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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
/* | |
* How to use: | |
* .DestroySquareAtPosition( Vector3 ) // | |
* .DestroyTriangleAtPosition( Vector3 ) // Returns true if a triangle was found; | |
* | |
*/ |
NewerOlder