Reddit user /u/GavrielBA is using three rhombuses to store a hexagon-shaped map
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.Numerics; | |
static bool InDistance1(Vector2 pos1, Vector2 pos2, float maxDistance) { | |
var distance = Math.Sqrt(Math.Pow(Math.Abs(pos2.X - pos1.X), 2) + Math.Pow(Math.Abs(pos2.Y - pos1.Y), 2)); | |
return distance <= maxDistance; | |
} | |
static bool InDistance2(Vector2 pos1, Vector2 pos2, float maxDistance) { | |
var distanceSquared = (pos2.X - pos1.X) * (pos2.X - pos1.X) + (pos2.Y - pos1.Y) * (pos2.Y - pos1.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
license: gpl-3.0 |
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
// Draw simple trees | |
// Author: [email protected] | |
// License: MIT | |
// TODO: read http://procworld.blogspot.com/2011/04/tree-bits.html | |
// TODO: read http://procworld.blogspot.com/2011/05/mango-sequoia-baobab.html | |
package { | |
import flash.display.*; | |
import flash.geom.Point; |
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
// SFC32 random number generator, public domain code adapted | |
// from https://github.com/bryc/code/blob/master/jshash/PRNGs.md | |
function PRNG(seed: number): { | |
nextInt(): number; | |
nextFloat(): number; | |
getState(): number[]; | |
setState(state: number[]): void | |
} { | |
let a = 0, b = seed, c = 0, d = 1; | |
function sfc32() { |
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() { | |
let array = []; | |
for (let i = 0; i < 10000000; ++i) { | |
array.push({ | |
a: i, | |
b: i / 2, | |
r: 0, | |
}); | |
} |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<style> | |
p { | |
max-width: 30em; | |
hyphens: auto; -webkit-hyphens: auto; | |
font-family: Arial; | |
} |
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
;;; my-notes.el --- | |
;;; Commentary: | |
;; My notes, inspired by org-roam, but built on other packages I already use. | |
;; | |
;; 1. Capture into a queue (org-capture) | |
;; 2. Review queue (org-agenda) | |
;; 3. Find note (find-file in folder). | |
;; 4. Make new note. Fill with title, date. |
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
;;; my-diary.el --- | |
;;; Commentary: | |
;; My daily diary, inspired by org-journal, but customized for my needs. | |
;; | |
;; My keybindings: H-j to open the diary file (global binding), then | |
;; H-j to add an entry (local binding). C-c C-b, C-c C-f to move days | |
;; (like org-journal). H-i to search previous headings for completion, | |
;; so that I can reuse headings and then analyze them. |
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
use legion::*; | |
use rltk::{GameState, Rltk, VirtualKeyCode, RGB}; | |
use std::cmp::{max, min}; | |
mod map; | |
pub use map::*; | |
struct Player {} | |
#[derive(PartialEq, Copy, Clone)] |
NewerOlder