Hacker Newsnew | past | comments | ask | show | jobs | submit | joejoint's commentslogin

of course you can pay, but where's the fun in that.. in a hacker's mind hacking youtube is time well spent.


Next to the name and age it's the profession. Here are some you think should not be allowed to vote.

Anna, 24 - Student. Alessandro, 30 - Doctor. Federico, 32 - Professor. Martino, 27 - Doctor.


goal : build a game - 1st solution : use framework + n days dev time - 2nd solution : use libraries + 10xn days dev time


That's true in most cases, if you want to make a game as fast as possible, if it's not too ambitious, if you like the framework, and if the constraints are satisfying.

Frameworks are not so cut and dry compared to libraries. Not using a framework is not necessarily a bad idea.


Godot lets you script with native code (GDNative) and more importantly lets you access the very low level parts of the engine should you so wish, allowing you to implement advanced custom functionality performantly.

I do get your point but honestly unless you're a big studio or a custom engine enthusiast, there's very few logical reasons not to use a framework.


Exactly. Also, most of the time frameworks/Engines has the tool you need to build a game. Only in some specific technical bottle neck you need to ditch game engines and go for libraries or some in-house tools. But in that case, it would be pretty artist-unfriendly.


Speed of light is a universal physical constant. What you referring is that the space the light has to travel in the optic cable is way bigger then what it would be with straight line of sight between MW towers.


The constant referred to as "speed of light" is speed of light in vacuum. Light slows down different amounts in different media.


Semantics, at best...


Why not just hash the string using constexpr ?

====================

C preprocessor based compile time hash from lolengine:

http://lolengine.net/blog/2011/12/20/cpp-constant-string-has...

====================

#define H1(s,i,x)(x65599u+(uint8_t)s[(i) <strlen(s)?strlen(s)-1-(i):strlen(s)])

#define H4(s,i,x) H1(s,i,H1(s,i+1,H1(s,i+2,H1(s,i+3,x))))

#define H16(s,i,x) H4(s,i,H4(s,i+4,H4(s,i+8,H4(s,i+12,x))))

#define H64(s,i,x) H16(s,i,H16(s,i+16,H16(s,i+32,H16(s,i+48,x))))

#define H256(s,i,x) H64(s,i,H64(s,i+64,H64(s,i+128,H64(s,i+192,x))))

#define HASH(s) ((uint32_t)(H256(s,0,0)^(H256(s,0,0)>>16)))

template<size_t N> constexpr uint32_t h(char const (&s)[N]) { return HASH(s); }

constexpr uint32_t h(const char s) { return HASH(s); }

uint32_t h(const std::string& s) { return h(s.c_str()); }

int main(int argc, const char argv) {

    auto s = "keep";
    std::string x = "simple";

    switch(h(x))
    {
        case h("keep")  : std::cout << "keep"; break;
        case h("it")    : std::cout << "it"; break;
        case h("simple"): std::cout << "simple"; break;

    };


Hash collisions would be one obvious problem with this approach. You could likely always tweak the hash used in response to collisions on the set of constants, but that's not going to be fun the first time it happens.

Also with that approach since it can't be made into a jump table it's still going to compile into a bunch of if/else combinations. At least with the trie it can early-return if the input doesn't have any chance of matching anything.


This is what I have done. However, you still have the risk of collisions. Depending on the context, like i did a small test and permuted all letters a-z and numbers and there are no collisions. However, changing a-z to A-Z resulted in many(may need to check code). However, this allows for a 5 character command switch.


The hash has to look at all the chars in the string.

Does the trie have to as well?


The string compare has a lot of branching and looks at both strings. The hash method one checks the hash of the test string(size_t) with the size_t of the other string. The hash itself, say fnv1a, can be very quick(a xor and a multiply I think per character) I think I remember testing this and it was quicker. ill try to find the test, but it is easily done. Either way, it's the only way to use a switch statement this way


If it’s possible for the string to not be in the set then you have to look at all chars.

Otherwise there are some cases you can skip characters. I generally don’t use this optimization when writing Tries because it’s tricky and rarely makes a difference.


Personally when I book an holiday I do that well in advance (4 to 6 months) trying to get a good deal. Most of the time cancel an holiday is expensive. Back in October I was looking for a ski holiday and looked at Denver, what put me off was not the possibility of Trump or Clinton be the president but the dollar vs pound. I do believe that one main reason for the decline in this period was the strong dollar appreciation against other currencies back in Nov/Dec. For many holidays travellers, economic reasons count more then political reasons when choosing the holiday destination.

Said that I'm going next week to Chicago.


wow, I dreamed I was in 2015 with powerful pocket size computers showing flashing GUIs with multitouch support. Darn.. I just woke up, I'm back in the 80's


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: