Skip to content

Instantly share code, notes, and snippets.

View jdermont's full-sized avatar
💭
🙃

Jacek Dermont jdermont

💭
🙃
View GitHub Profile
@jdermont
jdermont / myrandom.h
Created February 9, 2024 19:02
random number generator
// based on wyrand (wyhash), 2^64 period, sufficiently good quality
#include <cstdint>
#include <cstdlib>
using namespace std;
static const double NORM_DOUBLE = 1.0 / (1ULL << 53);
static const float NORM_FLOAT = 1.0 / (1ULL << 24);
class Random {
@jdermont
jdermont / gist:536312b020fd5a9a6383684e8854d05b
Last active January 25, 2024 18:53
Minishogi openings for testing
// 347 minishogi 8-ply openings, somewhat reasonable, probably not really balanced
// but can be used for testing with variety of openings
1rg1k/2bsp/5/PSB2/K1GR1 b - 9
r2g1/1sb1p/4k/PSB2/KG1R1 b - 9
2r1k/Bsbgp/5/PS3/KGR2 b - 9
1r1gk/1sb1p/5/PSB2/KG2R b - 9
r3k/1s1gp/1B3/PG1Sb/K2R1 b - 9
r3k/1s1gp/5/PSB1b/KG1R1 b - 9
1rg1k/2bsp/5/PSB2/KG1R1 b - 9
2r1k/1sbgp/5/PG1S1/K2BR b - 9
@jdermont
jdermont / unicode.cpp
Last active January 8, 2025 17:00
unicode characters for codingame
// How to copy bunch of floats into codingame, a bit lowered precision, assuming c++ code
// Not the smartest or best approach, but good enough for my needs
// locally in C++ code
void printWeightsToFile(const vector<float> & nn_weights, string name) {
float m = 0;
float sum = 0;
for (auto i : nn_weights) {
int32_t s = (int32_t)round((2048*(i+12)));
float x = (s/2048.0)-12;