This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum { CELL_KEY_SIZE=6 }; | |
stock void PackCellToStr(any key, char buffer[CELL_KEY_SIZE]) { | |
int k = key; | |
buffer[0] = ((k >> (7 * 4)) & 0x7F) | 0x80; | |
buffer[1] = ((k >> (7 * 3)) & 0x7F) | 0x80; | |
buffer[2] = ((k >> (7 * 2)) & 0x7F) | 0x80; | |
buffer[3] = ((k >> (7 * 1)) & 0x7F) | 0x80; | |
buffer[4] = ((k >> (7 * 0)) & 0x7F) | 0x80; | |
buffer[5] = 0x00; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* cfgscript.inc | |
* | |
* Copyright [2023] Assyrianic aka Nergal | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy of | |
* this software and associated documentation files (the "Software"), | |
* to deal in the Software without restriction, | |
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UCMP { | |
public static void main(String[] args) { | |
System.out.println("Hello World " + UInt32LT(1, -1)); | |
} | |
/// x < y | |
public static boolean UInt32LT(int x, int y) { | |
boolean sign_x = (x & 0x80000000) != 0; | |
boolean sign_y = (y & 0x80000000) != 0; | |
if( sign_x==sign_y ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ecs_helper.inc | |
* | |
* Copyright [2022] Nergal the Ashurian | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy of | |
* this software and associated documentation files (the "Software"), | |
* to deal in the Software without restriction, | |
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* linkedlist.inc | |
* | |
* Copyright [2021] Nergal the Ashurian aka Kevin Yonan | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy of | |
* this software and associated documentation files (the "Software"), | |
* to deal in the Software without restriction, | |
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* cfgmap.inc | |
* | |
* Copyright [2022] Nergal the Ashurian | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy of | |
* this software and associated documentation files (the "Software"), | |
* to deal in the Software without restriction, | |
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* arraymap.inc | |
* | |
* Copyright 2020 Nergal the Ashurian aka Nergal. | |
* | |
* This program 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. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Annulment rule: `a + 1 = 1`. | |
Idempotent rule: `a + a = a`, `aa = a`. | |
Complement rule: `aa̅ = 0`. | |
Absorption rule: `a + ab == a`, `a + a̅b == a+b`. | |
Identity rule: `a + 0 = a`, `a + a̅ = 1`, `a1 = a`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
"os" | |
"strings" | |
"strconv" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// colorful strings for printing. | |
const ( | |
COLOR_RED = "\x1B[31m" // used for errors. | |
COLOR_GREEN = "\x1B[32m" | |
COLOR_YELLOW = "\x1B[33m" | |
COLOR_BLUE = "\x1B[34m" | |
COLOR_MAGENTA = "\x1B[35m" // used for warnings. | |
COLOR_CYAN = "\x1B[36m" | |
COLOR_WHITE = "\x1B[37m" | |
COLOR_RESET = "\033[0m" // used to reset the color. |