Skip to content

Instantly share code, notes, and snippets.

View SecondReality's full-sized avatar

Steven Rose SecondReality

View GitHub Profile
@SecondReality
SecondReality / AnkiSuspender.py
Created February 10, 2018 19:16
Exports a list of suspended cards from Anki, and re-suspends them in another deck
from aqt import mw
from aqt.utils import showInfo
from aqt.qt import *
import json
def exportSuspendedCards():
cards = mw.col.findCards("\"deck:KKLC No Audio\"")
showInfo("Card count: %d" % len(cards))
import re
from enum import Enum
import csv
txtFolder = "C:\\FOLDERPATH\\"
filename = "Kanji_Learner_s_Course_Graded_Reading_Sets_vol_1.txt"
class ParseMode(Enum):
ChapterOrEntryLine = 0
ExpandedJapanese = 1
@SecondReality
SecondReality / VW.hs
Created December 26, 2013 06:14
This was a small Haskell program I made long ago work out the optimal minions to buy in the Vampire Wars Facebook game.
import Data.List (sortBy)
import Text.Printf (printf)
-- MinionData: Name, initial cost, produce, cost increase
data MinionData = MinionData String Integer Integer Integer deriving Show
minions =
[
MinionData "Bum" 5000 100 500,
MinionData "Park Jogger" 20000 400 2000,
@SecondReality
SecondReality / alpha_beta.h
Created May 28, 2012 18:50
Alpha-Beta Tron
//---------------------------------------------------------
// Generalised Alpha-Beta Search Algorithm Implementation
//---------------------------------------------------------
// by Steven Mark Rose
// Description:
// An alpha-beta search class finds the optimal move, given this information:
// search depth : integer : How many ply the tree will search to
// game : class : A world state class. Must have function move_count which returns the possible amount of moves given the current state and push_event which applies the given move (index) to the world state.
// adapter : class : A utility functor
//
// GameMain.h
//
// Created by Steven Mark Rose on 25/09/2010.
// Copyright 2010 Second Reality. All rights reserved.
//
#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>
#import "Texture2D.h"
//
// UITapTapTap.h
// Cat Toys
//
// Created by Steven Mark Rose on 01/11/2010.
// Copyright 2010 Second Reality. All rights reserved.
//
#import <Foundation/Foundation.h>
//
// FrogRenderer.h
// Cat Toys
//
// Created by Steven Mark Rose on 15/10/2010.
// Copyright 2010 Second Reality. All rights reserved.
//
#import <Foundation/Foundation.h>
@class Frog;
//
// Flexer.h
// OpenGLESTest
//
// Created by Steven Mark Rose on 26/09/2010.
// Copyright 2010 Second Reality. All rights reserved.
//
// The Flexer class is used to modify a vertex buffer so it can bend and trail and follow a moving point.
// Example uses are: Mouse Tails and Fish Bodies.
// After it has been initialised its length cannot be changed.