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
# Function to parse the game data from the input text | |
def parse_game_data(game_data): | |
games = {} | |
for line in game_data.strip().split('\n'): | |
if not line.startswith('Game'): | |
continue | |
game_id_str, *game_reveals_list = line.replace(':', ';').split(';') | |
game_id = int(game_id_str.split()[1]) | |
game_reveals = [] | |
for reveal in game_reveals_list: |
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
import cv2 | |
import pytesseract | |
from pytesseract import Output | |
import numpy as np | |
import re | |
import json | |
# Create a JSON object with a JSON array | |
palette = { | |
"name": "Vallejo Panzer Aces", |
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.Text; | |
static byte[] UnicodeCodepointToUtf8(int codepoint) | |
{ | |
if (codepoint >= 0 && codepoint <= 127) | |
{ | |
return new byte[] { (byte)codepoint }; | |
} | |
else if (codepoint >= 128 && codepoint <= 2047) | |
{ |
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
class Rope | |
{ | |
public HashSet<Point> VisitedPoints = new HashSet<Point>(); | |
Point[] knots; | |
public Rope(int knotCount) | |
{ | |
knots = new Point[knotCount]; | |
for(var x = 0; x < knotCount; x++) | |
{ |
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; | |
using System.Threading.Tasks; | |
namespace AdventOfCode | |
{ | |
/* ChatGPT created class, Renamed by human to not conflict with System.IO.File */ | |
public class AoCFile |
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
/* PROMPT: | |
Help me parse this terminal output using C#. The output represents a series of `cd` and `ls` commands, these commands start with '$'. if a `cd` command is followed by `..` this means to move up a level. otherwise it means to navigate to the folder whose name is given. | |
The remaining output is either a file, which is shown by file size and followed by file name, or it is a directory which starts with `dir` and is followed by the directory name. | |
Here is an example input: */ | |
using System; |
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
// Create a list to store the containers | |
List<List<string>> containers = new List<List<string>>(); | |
// Split the input string into lines | |
string[] lines = input.Split('\n'); | |
// Loop through each column in the input | |
for (int col = 0; col < 35; col += 4) | |
{ | |
// Create a list to store the entries in the current column |
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; | |
namespace CrateMover | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// Create a list of containers. |
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
/* Creation of the initial image editor on startup */ | |
34.788 PixelPaint(45:45): Image 0x00000018a567b6d0 has Undo Stack 0x00000018a567ba78 | |
34.792 PixelPaint(45:45): Pushed action to 0x00000018a567ba78 | |
34.800 PixelPaint(45:45): Switching tab to editor: ImageEditor(0x00000018a567b6d0) | |
45.390 PixelPaint(45:45): Completed action for editor 0x00000018a567b6d0, undo stack: 0x00000018a567ba78 | |
/* Drawing and undoing brush on initial image editor */ | |
45.394 PixelPaint(45:45): Pushed action to 0x00000018a567ba78 | |
46.800 PixelPaint(45:45): Undo action for 0x00000018a567ba78 | |
46.800 PixelPaint(45:45): Undo action for 0x00000018a567ba78 |
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
/* Note this requires DMSLib and Parser.cs from Pivet */ | |
/* Also requires a DMS export of PSPCMPROG and PSPCMNAME */ | |
using PeopleCodeLib.Decoder; | |
using System.Diagnostics; | |
var dmsFile = DMSLib.DMSReader.Read(@"C:\Users\tslat\Downloads\TIM_PT859.DAT"); | |
Console.WriteLine("Read file. Tables: " + dmsFile.Tables.Count); | |
var progTable = dmsFile.Tables.Where(t => t.Name == "PSPCMPROG").First(); |
NewerOlder