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.Generic; | |
using System.Linq; | |
using NUnit.Framework; | |
namespace Butjok.Aoc.Aoc2021.Day20 | |
{ | |
public static class Solution | |
{ | |
[TestCase(Inputs.example, 2, ExpectedResult = 35)] | |
[TestCase(Inputs.example, 50, ExpectedResult = 3351)] |
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 NUnit.Framework; | |
namespace Butjok.Aoc.Aoc2021.Day18 | |
{ | |
/* | |
* Делаю все операции explode и split на связанном списке токенов: по сути как работа со строками. | |
* Когда все готово - выстраиваю двоичное дерево и подсчитываю магнитуду рекурсивно. |
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 NUnit.Framework; | |
namespace Butjok.Aoc.Aoc2021.Day17 | |
{ | |
public static class Solution | |
{ | |
public const int maxYSpeed = 9999; |
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 NUnit.Framework; | |
namespace Butjok.Aoc2021.Day16 | |
{ | |
public abstract record Packet(long Version, long TypeId); | |
public record LiteralValuePacket(long Version, long TypeId, long Value) : Packet(Version, TypeId); | |
public record OperatorPacket(long Version, long TypeId, IList<Packet> SubPackets) : Packet(Version, TypeId); |
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.IO; | |
using System.Linq; | |
internal class Program | |
{ | |
public static void Main(string[] args) { | |
var lines = File.ReadLines("input.txt").Select(line => { | |
var numbers = line.Replace(" -> ", ",").Split(',').Select(int.Parse).ToList(); |
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.IO; | |
using System.Linq; | |
internal class Program | |
{ | |
private class Board | |
{ | |
public const int size = 5; |
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.Generic; | |
using System.IO; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Converters; | |
public class Db | |
{ | |
public static Db instance = new Db(); | |
public Dictionary<int, object> entities = new Dictionary<int, object>(); | |
public int nextEntityId; |
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; | |
public static class Observers | |
{ | |
public static Dictionary<int, HashSet<Action>> observers = new Dictionary<int, HashSet<Action>>(); | |
public static List<Action> list = new List<Action>(); | |
public static void Notify(int entityId) | |
{ |
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.Generic; | |
using System.Linq; | |
using UnityEngine; | |
public class Pool<T> where T : Component, ISpawnable | |
{ | |
public HashSet<T> freeInstances = new HashSet<T>(); | |
public Transform parent; | |
public T prefab; |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Newtonsoft.Json; | |
[JsonObject(MemberSerialization.OptIn)] | |
public class CircularStack<T> | |
{ | |
[JsonProperty] public int maxVirtualCount; |
NewerOlder