Skip to content

Instantly share code, notes, and snippets.

@k-tten
k-tten / HELPME.ts
Created July 22, 2023 05:20
WHY DOESNT THIS SHIT WORK
import OpeningBook from "../book/dynamic.js";
import { Adversary, Bitboard, Board, GameState, Move, MoveGenerator, Piece, Zobrist } from "../index.js";
import { AdversaryBestMoveConfig } from "./Adversary.js";
const PawnValue = 100;
const KnightValue = 300;
const BishopValue = 320;
const RookValue = 500;
const QueenValue = 900;
@k-tten
k-tten / ???.ts
Created July 16, 2023 00:00
WHAT THE FUCK IS WRONG WITH MY CODE
import { Adversary, Bitboard, Board, GameState, Move, MoveGenerator, Piece } from "../index.js";
const PawnValue = 100;
const KnightValue = 300;
const BishopValue = 320;
const RookValue = 500;
const QueenValue = 900;
const squareControlledByOpponentPawnPenalty = 350;
const capturedPieceValueMultiplier = 10;
// 7 points lay equally distanced on a circle. 3 points are chosen at random. What’s the probability that the triangle formed by the 3 points is acute?
const points: [x: number, y: number][] = [];
for (let i = 0; i < 7; i++) {
const angle = Math.PI * 2 * (i / 7);
points.push([Math.cos(angle), Math.sin(angle)]);
}
(()=>{var e={"./node_modules/call-bind/callBound.js":(e,t,r)=>{var n=r("./node_modules/get-intrinsic/index.js"),o=r("./node_modules/call-bind/index.js"),i=o(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&i(e,".prototype.")>-1?o(r):r}},"./node_modules/call-bind/index.js":(e,t,r)=>{var n=r("./node_modules/function-bind/index.js"),o=r("./node_modules/get-intrinsic/index.js"),i=o("%Function.prototype.apply%"),s=o("%Function.prototype.call%"),u=o("%Reflect.apply%",!0)||n.call(s,i),a=o("%Object.getOwnPropertyDescriptor%",!0),l=o("%Object.defineProperty%",!0),c=o("%Math.max%");if(l)try{l({},"a",{value:1})}catch(e){l=null}e.exports=function(e){var t=u(n,s,arguments);if(a&&l){var r=a(t,"length");r.configurable&&l(t,"length",{value:1+c(0,e.length-(arguments.length-1))})}return t};var p=function(){return u(n,i,arguments)};l?l(e.exports,"apply",{value:p}):e.exports.apply=p},"./node_modules/deep-equal/index.js":(e,t,r)=>{var n=r("./node_modules/object-keys/index.js"),o=r(
noop
noop
addx 5
addx 3
addx -2
noop
addx 5
addx 4
noop
addx 3
@k-tten
k-tten / README.md
Last active February 13, 2022 16:31
CodeWars RoboScript Kata Solutions

These are my solutions to the RoboScript series of katas on CodeWars.

This Kata Series is based on a fictional story about a computer scientist and engineer who owns a firm that sells a toy robot called MyRobot which can interpret its own (esoteric) programming language called RoboScript. Naturally, this Kata Series deals with the software side of things (I'm afraid Codewars cannot test your ability to build a physical robot!).

@k-tten
k-tten / better-rxjs-pipe.ts
Created November 9, 2021 16:35
Extension of my previous gist specialized for RxJS
type UnaryFunction<T, R> = (source: T) => R;
type Identity = <T>(source: T) => T;
type Pipe<T, L = void, R extends UnaryFunction<any, any>[] = []> =
T extends []
? R
: L extends void
? T extends [(_: infer P) => infer V, ...infer Rest]
? Pipe<Rest, V, [...R, UnaryFunction<P, V>]>
@k-tten
k-tten / pipe.ts
Last active November 9, 2021 16:13
Arbitrary arity pipe function typings
type UnaryFunction<T, R> = (source: T) => R;
type Pipe<T, L = void, R extends UnaryFunction<any, any>[] = []> =
T extends []
? R
: L extends void
? T extends [(_: infer P) => infer V, ...infer Rest]
? Pipe<Rest, V, [...R, UnaryFunction<P, V>]>
: never[]
: T extends [(_: L) => infer V, ...infer Rest]