HN user

nonsequitur

50 karma
Posts0
Comments12
View on HN
No posts found.

This doesn't work because you're not left-shifting (doubling) the carry. But when adding the shifted carry to (x ^ y) we're back to potentially overflowing the highest bits. The solution is to add the highest and the lower bits separately:

  lower = 0x7f7f7f7f;
  highest = ~lower;
  z = ((x & lower) + (y & lower)) ^ ((x ^ y) & highest);
Note this only improves performance for larger container integers.

There's no assignment to the „m“ variables that would make your algorithm work in the general case.

im4w1l's strategy is just:

Player i returns (i - [Sum of the other players' suits]) % 4

(With i ranging from 0 to 3)

Can anybody guess in which way he used convolution for solving what is generally known as the change-making problem? Wikipedia [1] mentions a "probabilistic convolution tree", but that seems much more involved.

Edit: Solved. I've missed that the problem only deals with change amounts that can be reached with one or two coins. So a single convolution is sufficient in this specific case.

https://en.wikipedia.org/wiki/Change-making_problem

I was dissappointed with the quality of the code and the final demo game. Also, it uses DirectX.

Here's an alternative: Dive into the GamePlay engine (https://github.com/blackberry/GamePlay/) and go through all the samples (https://github.com/blackberry/GamePlay/tree/master/samples), especially this collection of small feature demos (https://github.com/blackberry/GamePlay/tree/master/samples/b...). You'll get exposed to core concepts like Lighting, Terrain, Particles, 2D GUIs and Lua Scripting, all implemented from the ground up in C++ and OpenGL.