Skip to content

Instantly share code, notes, and snippets.

View Vertygo's full-sized avatar

Ivan Milosavljevic Vertygo

  • København, Denmark / Beograd, Serbia
View GitHub Profile
// The probe's x position increases by its x velocity.
// The probe's y position increases by its y velocity.
// Due to drag, the probe's x velocity changes by 1 toward the value 0; that is, it decreases by 1 if it is greater than 0, increases by 1 if it is less than 0, or does not change if it is already 0.
// Due to gravity, the probe's y velocity decreases by 1.
void Main()
{
var regEx = new Regex(@"(-?\d.+)\.{2}(-?\d+),.y=(-?\d+)..(-?\d+)");
var matches = regEx.Matches(input);
var minX = int.Parse(matches[0].Groups[1].Value);
// The probe's x position increases by its x velocity.
// The probe's y position increases by its y velocity.
// Due to drag, the probe's x velocity changes by 1 toward the value 0; that is, it decreases by 1 if it is greater than 0, increases by 1 if it is less than 0, or does not change if it is already 0.
// Due to gravity, the probe's y velocity decreases by 1.
void Main()
{
var regEx = new Regex(@"(-?\d.+)\.{2}(-?\d+),.y=(-?\d+)..(-?\d+)");
var matches = regEx.Matches(input);
var minX = int.Parse(matches[0].Groups[1].Value);
/*
- first 3 bits version
- second 3 bits type
Type = 4 LITERAL VALUE
encode a single binary number. To do this, the binary number is padded with leading zeroes until its length is a multiple of four bits, and then it is broken into groups of four bits. Each group is prefixed by a 1 bit except the last group, which is prefixed by a 0 bit.
Type = ther than 4 are OPERATOR
If literal value
rest of the value chunk by five
public void Main()
{
var board = new Board();
board.Parse(input);
for (int i = 0; i < 40; i++)
{
$"Step {i}".Dump();
board.Step();
}
public void Main()
{
var dots = input.Split("\r\n\r\n")[0];
var instructions = input.Split("\r\n\r\n")[1];
var board = new Board();
board.Parse(dots);
board.Fold(instructions);
board.Print();
$"Number of visible dots after ALL instructions: {board.Points.Count()}".Dump();
/*
): 3 points.
]: 57 points.
}: 1197 points.
>: 25137 points.
*/
void Main()
{
var commands = input.Split("\r\n").ToArray();
var opening = new List<char>(new[] { '(', '[', '{', '<' });
@Vertygo
Vertygo / AdventOfCode_Day_9_II.cs
Created December 9, 2021 08:40
Advent of Code Day 9 part 2
/*
*/
void Main()
{
var bord = new Bord();
bord.Parse(input);
@Vertygo
Vertygo / Scrap ASP.NET Community Standup links.txt
Created March 21, 2017 22:15
Scrap ASP.NET Community Standup links
@Vertygo
Vertygo / git.migrate
Created March 15, 2017 19:27 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.