Skip to content

Instantly share code, notes, and snippets.

@npruehs
npruehs / NicksBrain.java
Last active June 18, 2017 17:57
Animal AI that tries to stay alive and healthy.
public class NicksBrain extends Brain
{
// How far we're looking around for things like plants.
// Higher view range means better awareness of the environment, but also higher energy cost.
// Note that this is still capped by maxViewRange of the creature.
private static final int VIEW_RANGE = 2;
// Energy level that is considered healthy.
// If we're falling below this threshold, we'll run away and look for food.
private static final float HEALTHY_ENERGY_LEVEL = 0.8f;
@npruehs
npruehs / Main.cpp
Created April 1, 2017 15:37
PUGL system samples
// Setup:
this->testSystem = new TestSystem();
this->testScene = this->testSystem->CreateScene();
this->taskManager = new TaskManager();
// Usage:
if (taskManager->HasFinished())
{
IAsyncAction^ task = testScene->GetPrimaryTask();
public class Aufgabe9 {
public static void main(String[] args) {
System.out.println(korrektGeklammert("2*(3+(4+6))"));
System.out.println(korrektGeklammert("17+50]*6"));
System.out.println(korrektGeklammert("(3*[3+17)+2]"));
System.out.println(korrektGeklammert("(12/6)[1/3]"));
}
public static boolean korrektGeklammert(String s) {
@npruehs
npruehs / BlueprintPoolExtensions.cs
Last active February 11, 2016 22:05
Generated Entitas Blueprint Source Code Files - Example
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Entitas.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Entitas
{
@npruehs
npruehs / DictionaryDemo.cs
Last active December 7, 2015 18:25
Short example of how to use .NET Dictionaries.
// Create new dictionary.
Dictionary<Player, int> highscores = new Dictionary<Player, int>();
// Add some players.
var playerNick = new Player { Name = "Nick", Id = 1 };
var playerChristian = new Player { Name = "Christian", Id = 2 };
highscores.Add(playerNick, 33);
highscores.Add(playerChristian, 45);
@npruehs
npruehs / GameAnalyticsExampleMain.cpp
Last active August 29, 2015 14:15
Game Analytics Windows 10 UWP Test Code
// Sandbox.
//this->ga = std::make_shared<GameAnalytics::GameAnalyticsInterface>(L"5c6bcb5402204249437fb5a7a80a4959", L"16813a12f718bc5c620f56944e1abc3ea13ccbac");
// Production.
this->ga = std::make_shared<GameAnalytics::GameAnalyticsInterface>(L"a6d2a92e3572aebadead9b477441a246", L"8a429b59cd53dfccd063205b501b869b99e7e6e9");
this->ga->Init().then([this](JsonObject^ response)
{
this->ga->SendUserEvent(GameAnalytics::User());

Keybase proof

I hereby claim:

  • I am npruehs on github.
  • I am npruehs (https://keybase.io/npruehs) on keybase.
  • I have a public key whose fingerprint is 1159 A529 7577 4D08 22ED 9A1E DE9C 6814 41CC E95C

To claim this, I am signing this object: