This file contains hidden or 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
<?php | |
class P1 | |
{ | |
const DIRECTIONS = ['N', 'E', 'S', 'W']; | |
protected string $file; | |
protected int $x; | |
protected int $y; | |
protected int $degrees; |
This file contains hidden or 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
<?php | |
class P2 | |
{ | |
protected string $file; | |
protected int $x = 0; | |
protected int $y = 0; | |
protected int $wpx = 10; | |
protected int $wpy = 1; |
This file contains hidden or 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
<?php | |
require_once __DIR__ . '/../vendor/autoload.php'; | |
$input = <<<AOC | |
... | |
AOC; | |
const OCCUPIED = '#'; | |
const FREE = 'L'; |
This file contains hidden or 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
<?php | |
$input = <<<AOC | |
// ... | |
AOC; | |
function p1Data() { | |
global $input; | |
// read joltages | |
$adapters = array_map('intval', explode("\n", $input)); |
This file contains hidden or 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
<?php | |
$ops = []; | |
$lines = array_map('trim', file(__DIR__ . '/day8.txt')); | |
foreach($lines as $line) { | |
$ops[] = explode(' ', $line); | |
} | |
function emulate($ops, $infiniteReturn = false) { | |
$pos = 0; |
This file contains hidden or 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
<?php | |
// child => [...parents] | |
$part1Rules = []; | |
// parent => [...child => count] | |
$part2Rules = []; | |
$lines = array_filter(file(__DIR__ . '/data.txt')); | |
$regex = '/(?<parent>\w+\s\w+) bags contain|(?<count>\d+)\s(?<child>\w+\s+\w+) bag/'; |
This file contains hidden or 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
const pascal = require('./src/Indyo').factory('http://127.0.0.1:4103'); | |
const keyPair = pascal.Keys.decryptPrivateKey( | |
'53616C7465645F5FBCBB3CE7D3604D59B60B1F98065E743DAC933FFB5FDC384D0D18ED193F0C3BC03666634AB93CE1040C4B9B7FBAAA78120DF21D8AE241E8E0', | |
'test123' | |
); | |
(async () => { | |
await pascal.Wallet.send(keyPair, 91461, 91462, 0.1234, 'test123'); |
This file contains hidden or 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
const indyo = require('./src/Indyo').factory('http://127.0.0.1:4103'); | |
const keyPair = indyo.Keys.decryptPrivateKey( | |
'53616C7465645F5FBCBB3CE7D3604D59B60B1F98065E743DAC933FFB5FDC384D0D18ED193F0C3BC03666634AB93CE1040C4B9B7FBAAA78120DF21D8AE241E8E0', | |
'test123' | |
); | |
(async () => { | |
let account = await indyo.Accounts.findByAccountNumber(91461); | |
await account.send(keyPair, 91462, 0.1234, 'test123'); |
This file contains hidden or 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
const Coding = require('@pascalcoin-sbx/common').Coding; | |
const BC = require('@pascalcoin-sbx/common').BC; | |
const GUID = require('@pascalcoin-sbx/common').Types.GUID; | |
const CompositeType = Coding.CompositeType; | |
// perpare format | |
class Groupon extends CompositeType | |
{ | |
constructor() { | |
super('groupon'); |
This file contains hidden or 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 libraries | |
const SbxSigning = require('@pascalcoin-sbx/signing'); | |
const SbxRpc = require('@pascalcoin-sbx/json-rpc'); | |
const SbxCrypto = require('@pascalcoin-sbx/crypto'); | |
// import private key | |
const keyPair = SbxCrypto.importEncryptedPrivateKey( | |
'XXX', // encrypted private key | |
'XXX' // password | |
); |
NewerOlder