Skip to content

Instantly share code, notes, and snippets.

View Ravenslofty's full-sized avatar
💭
Black lives matter.

Lofty Ravenslofty

💭
Black lives matter.
View GitHub Profile
Rank Name ELO Games Score Draws
1 MVVLVA 156 400 71% 26%
2 REBEL-SEE -92 100 37% 32%
3 REBEL-SEE-XRay -92 100 37% 28%
4 CPW-SEE -230 100 21% 24%
5 CPW-SEE-XRay -230 100 21% 22%
# The author disclaims all copyright.
def lazy_sort(items_to_sort):
"""
Lazily sort a (key, value) list of items.
Best case performance: O(n) when you need only one item.
Worst case performance: O(n**2) when you need the list.
"""
for k1, v1 in enumerate(items_to_sort):
best = -(2**31)
Before:
14 26 759 10003985 1. e4 e5 2. Nf3 Nc6 3. d4 exd4 4. Nxd4 Nf6 5. Nc3 Bb4 6. Bg5 h6 7. Nxc6 dxc6
# 1st move cuts: 389533 total cuts: 486405 percent: 80
# Quiescence nodes: 5346357 Alpha-Beta nodes: 4657628
# LMRs: 0 Razors: 0 RFPs: 0 IIDs: 0
# TT probes: 742018 TT hits: 215818
# TT fails: 0
# TT illegals: 0
# TT hit rate: 29%
/*
* attacks.c - attack table update code.
*
* Copyright (C) 2016 Dan Ravensloft <[email protected]>
*
* This file is part of Dorpsgek.
*
* Dorpsgek is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Current TT:
14 26 1731 24629943 1. e4 e5 2. Nf3 Nc6 3. d4 exd4 4. Nxd4 Nf6 5. Nc3 Bb4 6. Bg5 h6 7. Nxc6 dxc6
# 1st move cuts: 988158 total cuts: 1239189 percent: 79
# Quiescence nodes: 13250602 Alpha-Beta nodes: 11379341
# LMRs: 0 Razors: 0 RFPs: 0 IIDs: 0
# TT probes: 1756769 TT hits: 313914
# TT fails: 0
# TT illegals: 0
# TT hit rate: 17%
/*
* This file is part of Dorpsgek.
*
* Dorpsgek is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Dorpsgek is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
const uint64_t RMagic[64] = {
[0] = 0x20800020400902b0ULL, // square 0: 7 bits shift, 10 bits in magic
[1] = 0x820020010c000ULL, // square 1: 11 bits shift, 6 bits in magic
[2] = 0x4082050020080ULL, // square 2: 9 bits shift, 7 bits in magic
[3] = 0x12000418100010ULL, // square 3: 6 bits shift, 7 bits in magic
[4] = 0x9000802086400ULL, // square 4: 8 bits shift, 8 bits in magic
[5] = 0x300010004000210ULL, // square 5: 10 bits shift, 6 bits in magic
[6] = 0x825020c801408ULL, // square 6: 11 bits shift, 11 bits in magic
[7] = 0x200084800860021ULL, // square 7: 12 bits shift, 9 bits in magic
[8] = 0xd80010d804000ULL, // square 8: 8 bits shift, 10 bits in magic
struct Move{
Pos from,to;
int score;
};
int negamax(int depth, Move & best_move){
Move option;
int best = -1000000;
if(0 == depth){
return score();
Mice:
M65Pro RGB URB Interrupt Answer: 0e 01 00 00 01 01 00 01 06 02 04 00 1c 1b 2e 1b 01 01 01 30 c1 ff 40 01 56 00 01 01 00 00 00 00 00 00 00 00 01 00 00 01 00 00 00 01 00 01 aa 00 6c dc 02 <zeroes>
M65Pro RGB URB Interrupt Answer: 0e 01 00 00 01 01 00 01 01 03 04 00 1c 1b 2e 1b 01 01 01 30 c1 ff 40 01 56 00 01 01 00 00 00 00 00 00 00 00 01 00 00 01 00 00 02 01 00 01 aa 00 6c dc 02 <zeroes>
Glaive RGB URB Interrupt Answer: 0e 01 00 00 01 01 00 01 03 01 10 00 1c 1b 34 1b 01 01 01 30 c1 ff 40 01 46 00 01 01 00 00 00 00 00 00 00 00 01 00 00 01 00 00 00 01 02 01 aa 00 6c dc 02 00 70 17 70 17 ff ff 00 02 28 23 28
Keyboards:
K70 RGB URB Interrupt Answer: 0e 01 00 00 00 01 00 01 05 02 12 00 1c 1b 13 1b 01 01 01 06 c0 ff 40 00 03 00 00 00 02 04 00 00 <zeroes>
K70 RGB URB Interrupt Answer: 0e 01 00 00 01 01 00 01 04 02 11 00 1c 1b 13 1b 01 01 01 05 c0 ff 40 00 03 00 00 00 02 04 01 00 <zeroes>
K70 RGB RF URB Interrupt Answer: 0e 01 00 00 01 01 00 01 04 02 14 00 1c 1b 38 1b 01 01 01 05 c0 ff 40 00 03 00 0
@Ravenslofty
Ravenslofty / extract.pl
Last active February 11, 2018 15:14
Mined USB IDs from CUE
#!/usr/bin/perl
while(my $line = <>) {
if ($line =~ /profile_([^.]+).xml:[^<]+<usbPid>([0-9]+)/) {
printf("%s: %4x\n", $1, $2);
} else {
print($line);
}
}
# Use as: