Skip to content

Instantly share code, notes, and snippets.

View jbevain's full-sized avatar

Jb Evain jbevain

View GitHub Profile

I'm not a completionist. I have little interest in getting all the achievements in a game and my interest for a game usually drops after I finish it.

However, there's one game that I have been playing for a long time, and where I only have one missing achievement on Xbox, and that is Rayman Legends. I've finished the game, I've replayed all levels multiple times, and my entire family is still playing it together. If you don't have a soft spot for Rayman, it's probably because you were not 12 and French when it came out. But Rayman Legends is a great platformer, it's still absolutely gorgeous, and it plays great. My last missing achievement is reaching level 11 in Rayman Legends.

Rayman Legends

To get to level 11 and get 100% achievements in Rayman Legends is a bit of a grind.

unsafe class Program
{
static void Main()
{
IO io = new(42);
IOPtr ioPtr = new(&io);
Settings(ioPtr);
Console.WriteLine(io.Foo);
}

For our Visual Studio Code extension, we implemented a debug adapter for our Unity debugger.

Part of the job is translating data structures from our debugger (say a UnityThread), to a DAP Thread. We're using a library that uses List<T> to represent collections.

I originally wrote:

UnityThread[] threads = ...;
List<DAPThread> dapThreads = threads.Select(CreateDAPThread).ToList();
@jbevain
jbevain / brittle.cs
Last active December 18, 2024 00:29
using System.Runtime.InteropServices;
unsafe class Program
{
static void Main()
{
ReadOnlySpan<byte> name = stackalloc byte[]
{
(byte)'J',
(byte)'b',
List<Machine> machines = [];
foreach (var machine in input.Split("\n\n"))
{
var lines = machine.Split("\n");
var a = Split(lines[0]);
var b = Split(lines[1]);
var prize = Split(lines[2]);
List<Machine> machines = [];
foreach (var machine in input.Split("\n\n"))
{
var lines = machine.Split("\n");
var a = Split(lines[0]);
var b = Split(lines[1]);
var prize = Split(lines[2]);
long sum = 0;
var reader = new StringReader(input);
while (reader.ReadLine() is string line)
{
var numbers = line.Split([' ', ':'], StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
if (numbers is [var test, ..var n] && SolveEquation(test, n))
{
sum += test;
}
var state = ParseState.OrderingRules;
Dictionary<int, HashSet<int>> rules = [];
List<List<int>> pageOrders = [];
var reader = new StringReader(input);
while (reader.ReadLine() is string line)
{
if (state == ParseState.OrderingRules)
{
if (line == "")
var lines = new List<string>();
using var reader = new StreamReader(args[0]);
while (reader.ReadLine() is string line)
{
lines.Add(line);
}
var grid = new char[lines.Count, lines[0].Length];
for (var i = 0; i < lines.Count; i++)
using System.Numerics;
using System.Runtime.InteropServices;
using var reader = new StreamReader("input.txt");
List<int> left = [], right = [];
while (reader.ReadLine() is string line)
{
var lineSpan = line.AsSpan();