50 karma · joined February 17, 2008
lower = 0x7f7f7f7f;
highest = ~lower;
z = ((x & lower) + (y & lower)) ^ ((x ^ y) & highest);
Note this only improves performance for larger container integers. getent ahosts myhostim4w1l's strategy is just:
Player i returns (i - [Sum of the other players' suits]) % 4
(With i ranging from 0 to 3)
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.
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.
for (n = 1; n <= 20; n++) {
window.alert(n << (n-1))
}
A short explanation: http://mathbin.net/98435