Skip to content

Instantly share code, notes, and snippets.

View xNWDD's full-sized avatar
🎯

Guillermo NWDD xNWDD

🎯
View GitHub Profile
#include <cstdint>
template<uint16_t d> struct lfm16 { //lemire fast math for 16-bit space https://github.com/lemire/fastmod
enum : uint32_t { M = uint32_t(-1) / d + 1 };
static constexpr uint16_t mod(uint16_t a) { return uint16_t((uint64_t(d) * uint32_t(M * a)) >> 32); }
static constexpr uint16_t div(uint16_t a) { return uint16_t((uint64_t(M) * a) >> 32); }
static constexpr bool mod0(uint16_t a) { return a * M <= M - 1; }
};
#include <iostream>
#include <string>
@xNWDD
xNWDD / axeswordbuzz.cpp
Created October 19, 2018 22:30
axeswordbuzz.cpp
#include <cstdio>
unsigned int rand(int & s, unsigned int l, unsigned int h) {
s = (unsigned short)((unsigned short)(s * 12829U) + 47989U);
unsigned short r = ((s >> ((s >> 13u) + 3u)) ^ s) * 62169u;
return l + (unsigned int)((((unsigned int)(((r >> 11u) ^ r))) * ((unsigned int)(1 + h - l))) >> 16);
}
int main(int argc, char *argv[]) {
for (int i = 0; i < 100000; ++i) printf("%s: %u %s: %u\n",
"sword", (rand(argc, 50, 70) * 3) / (2 + ((int)(rand(argc, 1, 100) <= 80))),
"axe", rand(argc, 1, 120) * (((int)(rand(argc, 1, 100) <= 15)) + 1)
// ==UserScript==
// @updateURL https://gist.github.com/xNWDD/03cb0809b0d09c02e454d74d4846c574/raw/GDCBVD.user.js
// @downloadURL https://gist.github.com/xNWDD/03cb0809b0d09c02e454d74d4846c574/raw/GDCBVD.user.js
// @name GDC Browse Video Downloader
// @description Tested with Tampermonkey in Firefox, Should not work in Greasemonkey, May Freeze Violentmonkey
// @version 2019r1
// @include /https?://www.gdcvault.com/*/
// @connect cdnapisec.kaltura.com
// @connect *.akamaihd.net
// @grant GM_download
/*********************************************
* Si no hay punto y coma *
* *
* t(ツ) *
* *
*No tienes que ponerlo en una línea separada *
**********************************************/
function magic(balls,radius,dir,oX,oY,sX,sY,ct){ (function magic(x=0,y=0,last=-1,total=0){ if(total!=balls) return ((x,y)=>{ ((v)=>function rec(n,...args){return v[n].apply(v,args),rec})(ct)("beginPath")("arc",oX+(dir?x:y),oY+(dir?y:x),radius,0,2*Math.PI)("fill") })(x*(radius*sX)-(y*radius),y*(radius*sY)), (x>last)?magic(0,y+1,x,total+1):magic(x+1,y,last,total+1) })() }
0.- Don't build everything at once, build something that works, then iterate, distribute and refactor.
1.- Write clean, self-explaining, predictable code, add comments if it's not.
2.- Follow the principle of least knowledge, consider state, platform & compiler specific code alien units.
3.- Use the right tool for the right job investigating languages, platforms, targets, compilers and debuggers.
4.- Don't reinvent, overinvent or keep unused inventions around (YAGNI/KISS).
5.- Write consistent code, following the project coding guidelines (identation, spacing, naming)
6.- Make units and functions do always the same ONE predictable thing in a predictable, ordered way.
7.- Don't optimize something that isn't a bottleneck.
8.- Avoid designing code so that it has to guard for specific cases.
9.- If test cases are trivial to implement, implement them.
#define wdwuc(X,Y) X##Y
#define wdwu(type,condition,counter) if(type) goto wdwuc(dowhile,counter); else while (condition) wdwuc(dowhile,counter):
#define wdw(type,condition) wdwu(type,condition,__COUNTER__)
#include <cstdio>
const char * strings[]{ "1", "2" , "3", 0 };
char * getpacket(){
static int i = 0;
if(!strings[i-1])
inline long long int powsign(long long int v){ return ((~(v & 0x1))<<1)+3; }
function d(s){
for(var i = parseInt(s);i--;)
console.log(1+Math.floor(Math.random()*parseInt(s.split("").slice(s.indexOf("d")+1).join(""))));
}
Feed me Vikings is an strategic puzzle mixing survival horror and resource management
in a princess defense game developed in HTML5 where players, have to manage a kingdom
in order to survive and defeat a fierce dragon.
The game is based on Saint George's tale and set in the vikings age, the game idea and
every game resource except PixiJS and some helper functions such as lerp weren created
during the last 48 hours of the jam.
===========
HOW TO PLAY

Videojuegos: ¿Pérdida de Tiempo?

Ya entrando en la definición de "pérdida de tiempo", es imposible que los videojuegos sean una pérdida de tiempo. ¿Por qué? Bueno, realmente es más simple de lo que parece:

Los videojuegos son un medio y no un contenido, es decir:

¿Es leer un libro una pérdida de tiempo?

Incluso si consideraramos todos los libros entretenidos una pérdida de tiempo, debido a que los libros son un medio, es imposible decir que leer/estudiar un manual de programación o un libro de biología es una pérdida de tiempo(a no ser que ya te sepas el contenido del libro de memoria).