Skip to content

Instantly share code, notes, and snippets.

@tkihira
tkihira / output.txt
Created October 2, 2022 02:30
Wordle Solver Output
{
maxCount: 6,
maxWord: 'shave',
minCount: 2,
minWord: 'hello',
average: 3.798704103671706
}
2 guesses: 80
3 guesses: 706
4 guesses: 1160
@tkihira
tkihira / words.js
Created February 1, 2022 07:13
wordle words
// ["cigar","rebut","sissy","humph","awake","blush","focal","evade","naval","serve","heath","dwarf","model","karma","stink","grade","quiet","bench","abate","feign","major","death","fresh","crust","stool","colon","abase","marry","react","batty","pride","floss","helix","croak","staff","paper","unfed","whelp","trawl","outdo","adobe","crazy","sower","repay","digit","crate","cluck","spike","mimic","pound","maxim","linen","unmet","flesh","booby","forth","first","stand","belly","ivory","seedy","print","yearn","drain","bribe","stout","panel","crass","flume","offal","agree","error","swirl","argue","bleed","delta","flick","totem","wooer","front","shrub","parry","biome","lapel","start","greet","goner","golem","lusty","loopy","round","audit","lying","gamma","labor","islet","civic","forge","corny","moult","basic","salad","agate","spicy","spray","essay","fjord","spend","kebab","guild","aback","motor","alone","hatch","hyper","thumb","dowry","ought","belch","dutch","pilot","tweed","comet","jaunt","enema","steed","abyss","gro
@tkihira
tkihira / fib.html
Last active February 18, 2018 12:47
<html><head><title>WebAssembly: JavaScript binding profiling</title>
<script>
onload = function() {
var textarea = document.getElementById("textarea");
var log = function(message) {
var now = performance.now();
textarea.value += (now - time).toFixed(3) + ": " + message + "\n";
time = performance.now();
};
var time = performance.now();
var data = [1, 4, 5, 6, 7, 8];
//var data = [2, 3, 5, 7, 11, 13, 17];
//var data = [2, 3, 5, 10, 20];
var a = [];
var r = function(u) {
if(a.length == data.length - 1) {
if(u) return solve();
else return false;
}
(function() {
var canvas;
var ctx;
var isWorking = false;
var exchangeRate = 0;
var timerId;
var found = false;
var maxHPS = 0;
var hpsList = [];
@tkihira
tkihira / daida.js
Last active November 3, 2015 11:20
代打って効果あるの?
var originalRatios = [
.259, .337, .330, .267, .188, .274, .224, .227, .091
];
function calcHit(h, bases) {
if(h > 2) {
// homerun
var s = 1 + (bases[0]?1:0) + (bases[1]?1:0) + (bases[2]?1:0);
bases[0] = bases[1] = bases[2] = false;
return s;
@tkihira
tkihira / gist:1483c90f26eb92021306
Created May 27, 2015 03:05
1+23-4+56+7+8+9 = 100
#include <stdio.h>
void recursive(int level, int* op) {
if(level == 8) {
int result = 0;
int lastOp = 1;
int stack = 0;
for(int i = 0; i < 9; i++) {
int num = i + 1;
stack *= 10;
// http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
"use strict";
// Optional. You will see this name in eg. 'ps' or 'top' command
process.title = 'node-chat';
// Port where we'll run the websocket server
var webSocketsServerPort = 1337;
// websocket and http servers
@tkihira
tkihira / meta.cpp
Created December 26, 2014 03:53
Meta-programming for ten puzzle
#include <stdio.h>
template<int a_bunshi, int a_bunbo>
struct Calc1 {
enum { result = (a_bunbo != 0 && a_bunbo * 10 == a_bunshi) };
};
template<int a_bunshi, int a_bunbo, int b_bunshi, int b_bunbo>
struct Calc2 {
enum {
@tkihira
tkihira / max
Last active August 29, 2015 14:10
function max(a, b) {
// 差のある最上位のビットを立てる
// (例えば 11010010 と 10110101 の場合、 x は 01000000 )
var x = a ^ b;
x |= x >>> 1;
x |= x >>> 2;
x |= x >>> 4;
x |= x >>> 8;
x |= x >>> 16;
var h = x ^ (x >>> 1);