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
(defn a-star [get-options calc-distance from to] | |
(let [add-node (fn [queue node] | |
(if (> (calc-distance (:pos (first queue)) to) (calc-distance (:pos node) to)) | |
(cons node queue) | |
(cons (first queue) (add-node (rest queue) node)))) | |
process (fn [[node & queue] visited] | |
(if (= (:pos node) to) node | |
(if (and (get visited (:pos node)) (< (:cost (get visited (:pos node))) (:cost node))) | |
(process queue visited) | |
(let [new-nodes (for [new-pos (get-options (:pos node))] |
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
// g++ -Ofast -fomit-frame-pointer -funroll-loops -o reaktor_outrun reaktor_outrun.cpp | |
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <limits> | |
#include <cctype> | |
#include <cstdio> | |
int main(int argc, char** argv) | |
{ |
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
#include <iostream> | |
#include "../src/promise.h" | |
int main(int argc, char** argv) | |
{ | |
Promise<int> p; | |
p.then<int>([](int const& i) { | |
std::cout << "1 = " << i << std::endl; |
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
import Html | |
import Html (..) | |
import Window | |
main = lift scene Window.dimensions | |
scene (w,h) = Html.toElement w h content | |
content = node "div" [] [] | |
[ text "Hellollo World" |
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
#include <iostream> | |
#include <cassert> | |
#include <string> | |
// Algebraic type | |
enum ShapeType { CIRCLE, RECTANGLE, ZERO }; | |
struct Circle { int cx, cy, r; static const ShapeType type = CIRCLE; }; | |
struct Rectangle { int x, y, w, h; static const ShapeType type = RECTANGLE; }; | |
struct Zero { static const ShapeType type = ZERO; }; |
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
#include <iostream> | |
#include <vector> | |
#include <type_traits> | |
template<template<typename...> class Container, typename T, typename... Ts> | |
class ContainerTuple | |
{ | |
public: | |
template<typename TT> | |
typename std::enable_if<std::is_same<T, TT>::value, Container<T>&>::type get() |
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
#include <iostream> | |
#include <functional> | |
#include <vector> | |
using Cb = std::function<void()>; | |
using Cbs = std::vector<Cb>; | |
void print(Cbs& cbs) | |
{ | |
auto n = cbs.size(); | |
for(decltype(n) i = 0; i < n; ++i) |
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
#!/bin/bash | |
COMMAND=$1 | |
TESTLIST=$2 | |
DONELIST=$3 | |
touch "$DONELIST" | |
while read TEST; do | |
if [ -z "$TEST" ]; then | |
echo |
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 E(node) { | |
function isChildren(x) { return x instanceof Array; } | |
function isText(x) { return typeof x === "string"; } | |
if(!(node instanceof Array)) | |
return node; | |
var element = node[0]; | |
var props = null; | |
var text = null; |
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
import QtQuick 2.4 | |
import QtQuick.Window 2.2 | |
import goqml 1.0 | |
Window { | |
visible: true | |
property var roles: ["bullet", "enemyBullet", "player"] | |
function getRole(name) | |
{ |
OlderNewer