Skip to content

Instantly share code, notes, and snippets.

@alexminnaar
alexminnaar / ludii_jni_example.cpp
Last active March 23, 2020 10:38
Using the Ludii jar in cpp with JNI and calling the `listGames()` method
/*
Copyright (c) 2020 Alex Minnaar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@alexminnaar
alexminnaar / dfs.py
Created June 17, 2019 01:38
depth-first search
class Node:
def __init__(self, x):
self.val = x
self.children = []
def dfs(node, target):
# if the node is found then return it
if node.val == target:
return node
@alexminnaar
alexminnaar / gist:a286912efa417dfd0f25bd33992c3d6b
Created March 27, 2017 00:56
Joint image/text classifier in Keras
import numpy as np
from keras.layers import Dropout
from keras import applications
from keras.layers import Dense, GlobalAveragePooling2D, merge, Input
from keras.models import Model
max_words = 10000
epochs = 50
batch_size = 32
@alexminnaar
alexminnaar / gist:8f9ed5eb61dcef22c35eefcf2d7022b1
Last active August 25, 2016 21:17
Balanced Interleaving Algorithm
import random
def a_start_check():
if random.random() > 0.5:
print "A first"
return True
else:
print "B first"
return False