Skip to content

Instantly share code, notes, and snippets.

#region
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Sokoban;
using Sokoban.Serialization;
using UnityEngine;
#endregion
#region
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using UnityEngine;
#endregion
namespace Tests
using UnityEngine;
//https://www.cs.jhu.edu/~misha/MyPapers/EUROG20.pdf Appendix A
namespace PolygonCenterFinder
{
public static class PolygonCenter
{
public static Vector2 GetPolygonCenter(Vector2[] verts)
{
using UnityEngine;
using UnityEngine.Serialization;
public class SphereCollisionTest : MonoBehaviour
{
[FormerlySerializedAs("avoidanceCheckCount")]
[SerializeField]
int testCount = 20;
const puppeteer = require('puppeteer');
const fs = require("fs");
(async () => {
const browser = await puppeteer.launch(`headless: "new"`);
const page = await browser.newPage();
await page.goto('https://twitter.com/apastoraldream');
fs.writeFileSync("tweets.txt", "");
var allTweets = new Set();
@MalcolmMacDonald
MalcolmMacDonald / ObscuredUrbanDictionaryWords.json
Created May 9, 2022 04:59
Obscured Urban Dictionary Words
[
{
"word": "_ _ _ _ _ _ ",
"definition": "Cold hard cash, we aint talking about no fifty dollars, _ _ _ _ _ _ is mad money, huge amounts."
},
{
"word": "_ _ _ _ ",
"definition": "Abbrevation for why the hell not?"
},
{
This file has been truncated, but you can view the full file.
[
{
"word": "chedda",
"definition": "Cash money, synonymous with scrilla.",
"score": 346
},
{
"word": "wthn",
"definition": "Abbrevation for why the hell not?",
"score": 10
@MalcolmMacDonald
MalcolmMacDonald / PolygonCenter.cs
Created March 23, 2022 17:59
Polygon Center Finder
using UnityEngine;
public static class PolygonCenter
{
public static Vector2 GetPolygonCenter(Vector2[] verts)
{
var matA = CreateAMatrix(verts);
var vecB = CreateBVector(verts);
alglib.rmatrixsolve(matA, vecB.Length - 1, vecB, out _, out _, out var x);
@MalcolmMacDonald
MalcolmMacDonald / IntersectLineSegments.cs
Created February 11, 2022 21:23
Line Segment intersection
public static bool IntersectLineSegments(Vector2 a0, Vector2 a1, Vector2 b0, Vector2 b1, out Vector2 intersection)
{
Vector3 X = Vector3.Cross(
Vector3.Cross(((Vector3)a0) + Vector3.forward, ((Vector3)a1) + Vector3.forward),
Vector3.Cross(((Vector3)b0) + Vector3.forward, ((Vector3)b1) + Vector3.forward));
intersection = new Vector2(X.x / X.z, X.y / X.z);
//Lines are not parallel
if (float.IsNaN(intersection.x) || float.IsNaN(intersection.y))
@MalcolmMacDonald
MalcolmMacDonald / index.js
Created January 10, 2022 00:58
TicTacToe game tree graph
var util = require('util'),
graphviz = require('graphviz'),
fs = require('fs');
let allBoards = {};
let nodesInGraph = {};
let rotationArray = [1, 2, 5, 0, 4, 8, 3, 6, 7];
let mirrorArray = [2, 1, 0, 5, 4, 3, 8, 7, 6]