Skip to content

Instantly share code, notes, and snippets.

@maksverver
maksverver / player-template.js
Created November 14, 2024 23:46
Codecup Box Javascript player for Caia (compatible with Node.js and d8)
#!/usr/bin/d8 --single-threaded
// d8 defines print() and printErr() which write to stdout and stderr.
// In Node.js, we can use console.log() and console.error() for this.
const print = globalThis.print || console.log;
const printErr = globalThis.printErr || console.error;
// Global player initialization
let myColor = undefined;
let firstMove = undefined;
@maksverver
maksverver / speler.js
Last active November 12, 2024 22:31
Voorbeeld CodeCup speler Box/Square in Javascript
#!/usr/bin/d8 --single-threaded
// Voor Caia:
// 'D' voor een deterministische speler
// 'R' voor een nondeterministische speler
printErr('D', 'voorbeeldspeler');
const mijnKleur = Number(readline());
printErr('Mijn kleur:', mijnKleur);
@maksverver
maksverver / MinimaxCPU.js
Created October 20, 2024 20:06
StackAndCoquer new AI players
/**
* \file MinimaxCPU.js
*
* \section LICENSE
*
* Copyright (C) 2024 Maks Verver
*
* This file is part of StackAndConquer.
*
* StackAndConquer is free software: you can redistribute it and/or modify
#!/usr/bin/env python3
import io
import libxml2
import xml.sax.xmlreader
from drv_libxml2 import LibXml2Reader
def parse_binary():
source = xml.sax.xmlreader.InputSource()
source.setByteStream(io.BytesIO(b'<?xml version="1.0" encoding="UTF-8"?>\n<root />\n'))
@maksverver
maksverver / makepkg output
Created June 22, 2024 20:47
mingw-w64-curl 8.8.0 configure failure when wine is installed
==> Making package: mingw-w64-curl 8.8.0-1 (Sat 22 Jun 2024 10:42:22 PM CEST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Found curl-8.8.0.tar.xz
==> Validating source files with sha256sums...
curl-8.8.0.tar.xz ... Passed
==> Extracting sources...
-> Extracting curl-8.8.0.tar.xz with bsdtar
==> Starting build()...
import java.util.*;
import java.util.stream.Collectors;
import com.google.common.collect.SortedMultiset;
import com.google.common.collect.TreeMultiset;
class Test {
static List<Integer> solvePriorityQueue(List<Integer> list, int m) {
PriorityQueue<Integer> pq = new PriorityQueue<>(list.subList(0, m));
List<Integer> res = new ArrayList<>(list.size() - m + 1);
Integer mth = pq.peek();
ihgfeiyxhgfvutonkhfedzylkhgklxwvutsrijknxwtspofgjknorsghklopstwxyzutonmlihgcbaghirqptqpvwnokjiihgfdefghijklmabcedcbfghijklmkjihgbcmnqruvwwvutsrnmlkjbcnmlihsrqnmihgfqpcpondeflmpqruvwxyefijlmnopqwvutsrq
jklmrsvwijewaspmjigbcexmjifjzyrsfedqonlmyvurqnehilmpqtfijmnqruvefghspbakjefddefzjknosrourqployjkdecuvcdrqponfedfnmdecdehyxnlmnofedlopstyxlkhgnqotuhiedopkjgfepoljcdenojilmcjgknoqrtsrklmghkkbutsrnojkijp
hgfnqtumlkdcbrqljihjifwnopedfpqhglkppmjihopklmdcadeyxuedcbawpocdmlirqcpqrdbecopyxlmmnantsutmnxmlcbbtwfestwxygnogolkjigficwvurqpjifkjibcznojifoppsvwgfsrqefghdcjkkbpomlkfkjbihjihponmqponxblscdghlmpighko
ijeopponuvynoijkklmkhgvutqbcgonijmnoqlkfgnqjefijbcfzwvjionuvqnmonkjgddodihgfmnqrwvklobmlwvsrqwnefklsrghiuvgfhmphpqfghhkjdihtsqrkhgnmhgdlmpqredcqryzhutpodcaijhimlblnefgghidcbgfeijdlkpqrwvmrqefikjghajkn
lkdcbqrstwxmlhgfeonljklmsrtuhimlkaabrsbelmridghksrghmlkhlmtsrklpqonfeenkjedalkjstujqpcjkxdeopvodgjmpqekjliheiljisredjilmefgxypslqpolkfekfedszrstwxnisrqnmlblkgoncbkjdihqrfeijkpohklijonstunopnmjfifcbilm
mpqraijsrbajkbacdpn
@maksverver
maksverver / test-4-competition-313-games.csv
Created October 7, 2023 10:52
CodeCup test competition 4 results with transcripts
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 11 columns, instead of 9 in line 6.
Game,Round,IsSwiss,User1,Score1,Status1,User2,Score2,Status2,Moves,Solution
243593,1,swiss,Louis Verhaard,2,WIN,Antonio Morillas,1,LOSE,Eb7 Dh8 Fb8 Ei1 Ac4 Be5 Fc6 Gd7 Dc1 Cc5 Bf3 Id2 Hh1 Fa2 Gh6 Ce7 Df7 Gb2 Hc7 Ai6 Aa7 Ig9 Bg7 Ff9 Ic8 If4 Hb3 Fd3 Ad8!,714892356862153749395476128941527683573648291286319574429731865637985412158264937
243594,1,swiss,Antonio Morillas,1,LOSE,Louis Verhaard,2,WIN,Gg2 Dc3 Di8 Gi6 Ce4 Ch8 Gf5 Bc7 Ff9 Bf6 Ef1 If8 Fb6 Ee3 Ib3 Gc8 Ci1 Fe8 Db7 Eb8 Fg3 Dg1 Ae1 Fc1 Hc6 Ic4 Ai5 Ia7 Aa3 Fh5 Ea5 Af2!,349812675817956423625347981973524168582631794461789352198475236256193847734268519
243595,1,swiss,Rust Kokkie,2,WIN,Sebastiaan Roodenburg,1,NO_SOLUTION_DECREASED,Aa2 Ae1 Ab4 Ah3 Ac6 Af5 Ad8 Ai7 Ba3,
243596,1,swiss,Sebastiaan Roodenburg,1,NO_SOLUTION_DECREASED,Rust Kokkie,2,WIN,Fb1 Aa2 Ea3 Ab4 Bb3 Ac5 Cb6 Ad3 Bc1 Ae6 Ca7 Af7 Ba8 Ag8,
243597,1,swiss,Joe Rahn,1,NO_SOLUTION_DECREASED,Lukas Pestalozzi,2,WIN,Aa1 Ab2 Ac6 Ad3 Ae8 Af4 Ag5 Ah7,
243598,1,swiss,Lukas Pestalozzi,2,WIN,Joe Rahn,1,NO_SOLUTION_D
@maksverver
maksverver / test-3-competition-314-games.csv
Created September 16, 2023 12:39
CodeCup test competition 3 annotated with game transcripts
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 11 columns, instead of 10 in line 3.
Game,Round,IsSwiss,User1,Score1,Status1,User2,Score2,Status2,Moves,Solution
240659,1,swiss,Fabio Murer,1,LOSE,Michiel Smits,2,WIN,Di5 Ig5 Fd5 Bb3 Fg4 Ad4 Ia9 Hb6 Bd2 Cd3 Be7 Aa2 Ih7 Hh4 Ba8 Eg9 Ab1 Ae9 Ac5 Ag7 Af6 Bf1 Ah3 Bg6 Ai8 Bh5 Bc4 Ci4 Bi9 Gh9 Ca6 Hd9 Cb7 Cc9 Ce5 Cf8 Cg1 Ch2 Da1 Fa3 Db2 Fb9 Dc6 Fc8 Dd7 Ef3 De4 Fi7 Df9 Ec7 Dg3 Dh8 Ea4 Ff2 Eb5 If4 Ed1 Gg2 Ee8 Gd8 Eh6 Fe6 Ei2 Fh1 Ga5 Hc1!,215496738834271659679358124126749385457183962398562417543817296761925843982634571
240660,1,swiss,Michiel Smits,2,WIN,Fabio Murer,1,LOSE,Cd1 Be6 Bc4 Ha5 Ac7 De7 Ai6 Hf8 Ab3 Hb4 Ad8 Bf7 Bi9 Ag2 Bd3 Aa1 Cc9 Ae4 Ah5 Af9 Bg1 Ba2 Ch4 Bb5 Bh8 Ca6 Cg3 Cb8 Hi2 Ce2 Hc1 Cf5 Ci7 Da3 He3 Db1 Hd7 Dc2 Ef6 Dd5 Fb9 Df4 Ii1 Dg6 Ga7!,137849256254367189689125347312574698875916423496283715728691534541738962963452871
240661,1,swiss,Joe Rahn,0,EXIT,Antonio Morillas,2,WIN,Aa7 Dh7 Ab6 Df3 Af5 Db1 Ac4 Dc5 Ad3 Ci9 Ag1 Ga4 Ah8 Ia2 Ai2 Be6 Ae9 Dg8 Da6 He1 Di4 Ge3 De2 Cf1 Dd9 Ig6 Bh3 Eb4 Bi5 Gf8 Bg4 Ic8 Cg7 Ef6 Ch6 Bb8 Ba1 Fb2 Bc9 Cd4 Ce8 Hb3 Cb5 Gg2
@maksverver
maksverver / results.csv
Created August 26, 2023 18:49
CodeCup 2023 test competition 2 win rates as player 1 and player 2
Name P1 Wins P1 Losses P2 Wins P2 Losses Total wins P1 Winrate P2 Winrate
Maks Verver 36 0 28 8 64 100.00% 77.78%
Louis Verhaard 36 0 23 13 59 100.00% 63.89%
Mark ter Brugge 36 0 21 15 57 100.00% 58.33%
Michiel Smits 35 1 22 14 57 97.22% 61.11%
Rust Kokkie 34 2 23 13 57 94.44% 63.89%
Nathan Fenner 33 3 23 13 56 91.67% 63.89%
Antonio Morillas 34 2 21 15 55 94.44% 58.33%
Marc Oldenhof 34 2 20 16 54 94.44% 55.56%
Jasper van Merle 32 4 21 15 53 88.89% 58.33%