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
<?xml version="1.0" encoding="utf-8" ?> | |
<rss version="2.0" xml:base="/blog.rss" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:mapbox="http://mapbox.com/"> | |
<channel> | |
<title>Blog - Mapbox</title> | |
<link>https://www.mapbox.com/blog</link> | |
<description>Updates from the Mapbox team.</description> | |
<language>en</language> | |
<item> | |
<title>Kevin joins Mapbox!</title> |
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
0xdB681dbd498eee00F13f8788760a78D2A038b8b2 |
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
const difficulty = this.blockchain.getDifficulty(); | |
do { | |
block.timestamp = new Date().getTime() / 1000; | |
block.nonce++; | |
block.hash = block.toHash(); | |
blockDifficulty = block.getDifficulty(); | |
} while (blockDifficulty >= difficulty); |
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
{ // Address | |
"index": 1, | |
"secretKey": "6acb83e364...ee6bcdbc73", // EdDSA secret key generated from the secret (1024 bytes) | |
"publicKey": "dda3ce5aa5...b409bf3fdc" // EdDSA public key generated from the secret (64 bytes) (also known as address) | |
} |
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
[ | |
{ // Wallet | |
"id": "884d3e0407...f29af094fd", // random id (64 bytes) | |
"passwordHash": "5ba9151d1c...1424be8e2c", // hash taken from password: sha256 (password) (64 bytes) | |
"secret": "6acb83e364...c1a04b6ee6", // pbkdf2 secret taken from password hash: sha512 (salt + passwordHash + random factor) | |
"keyPairs": [ | |
{ | |
"index": 1, | |
"secretKey": "6acb83e364...ee6bcdbc73", // EdDSA secret key generated from the secret (1024 bytes) | |
"publicKey": "dda3ce5aa5...b409bf3fdc" // EdDSA public key generated from the secret (64 bytes) (also known as address) |
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
{ // Transaction | |
"id": "84286bba8d...7477efdae1", // random id (64 bytes) | |
"hash": "f697d4ae63...c1e85f0ac3", // hash taken from the contents of the transaction: sha256 (id + data) (64 bytes) | |
"type": "regular", // transaction type (regular, fee, reward) | |
"data": { | |
"inputs": [ // Transaction inputs | |
{ | |
"transaction": "9e765ad30c...e908b32f0c", // transaction hash taken from a previous unspent transaction output (64 bytes) | |
"index": "0", // index of the transaction taken from a previous unspent transaction output | |
"amount": 5000000000, // amount of satoshis |
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
{ // Block | |
"index": 0, // (first block: 0) | |
"previousHash": "0", // (hash of previous block, first block is 0) (64 bytes) | |
"timestamp": 1465154705, // number of seconds since January 1, 1970 | |
"nonce": 0, // nonce used to identify the proof-of-work step. | |
"transactions": [ // list of transactions inside the block | |
{ // transaction 0 | |
"id": "63ec3ac02f...8d5ebc6dba", // random id (64 bytes) | |
"hash": "563b8aa350...3eecfbd26b", // hash taken from the contents of the transaction: sha256 (id + data) (64 bytes) | |
"type": "regular", // transaction type (regular, fee, reward) |
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
var newX = Math.cos(angle) * (this.x - origin.x) - Math.sin(angle) * (this.y - origin.y) + origin.x; | |
var newY = Math.sin(angle) * (this.x - origin.x) + Math.cos(angle) * (this.y - origin.y) + origin.y; |
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
crossover(partner) { | |
const newDNA = new DNA(this.genes.movement.length); | |
newDNA.genes.movement = this.crossoverMovement(partner); | |
newDNA.genes.size = this.crossoverSize(partner); | |
newDNA.genes.maxForce = this.crossoverMaxForce(partner); | |
return newDNA; | |
} | |
crossoverMovement(partner) { | |
// Selects a random midpoint position and cross the dna genes from that midpoint |
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
// Randomly choose two partners from mating pool and mate them | |
let newOrganisms = []; | |
for (let i = 0; i < this.organisms.length; i++) { | |
const parentA = p5i.random(this.matingPool); | |
const parentB = p5i.random(this.matingPool); | |
const child = parentA.mate(parentB); | |
newOrganisms[i] = child; | |
} | |
this.organisms = newOrganisms; |
NewerOlder