Category: Games

Circle Swap

Sadly, The company I worked for – Planet of the Apps, ran into financial difficulties.
Now I’m working at a new place, called Mohican Lab.

Circle Swap

Before I left, I worked on a level version for my game: Ensō.
The game got a new skin and a few tweaks and it’s going to be awesome!
It’s nice to see my work lives on.
Hopefully, that will give them the boost they need.

The adventures of Doca

I made a short game (HERE) for Game By Its Cover Jam.
This is the inspiring cover:

Silly programming challenge: Choose randomly -1 or 1

My friend Aviv, a fellow Unity developer, and me were trying to figure out how many different significant ways we can come up with to solve the simple problem of choosing a random value.
You can try this silly challenge yourself, or jump right to our solution.
Let me know if you found other solutions.

float ex1 = Mathf.Sign(Random.Range(-0.5f, 0.5f));

float ex2 = Mathf.Sign(Random.Range(-1,1));

int ex3 = (Random.Range(0,2) * 2) – 1;

int ex4 = Random.Range(0,2);
if (ex4 == 0) { ex4 = -1; }

int[] choices = new int[]{-1, 1};
int ex5 = choices[Random.Range(0, ex5.Length)];

int ex6 = (Random.value > 0.5f) ? 1 : -1;

int ex7 = Mathf.Sign (Random.rotation.x);

List<int> values = new List<int>(){1,-1};
int ex8 = Random.Range(-1,2);
while (!values.Contains(ex8)) { ex8 = Random.Range(-1,2); }

Of those, I would say ex1 is too similar to ex2 (also it was interesting to notice it would work with integers too).
So I would score us 7 solutions.

I would choose ex6 for real life usage, since I think it’s the most readable.
ex7 is the funniest but it should work (notice we are using the UnityEngine library, not the System library)

עמוד: 1 2 3 4 5 6 7 הבא