Given two numbers generate a number that is not one of the two numbers

Propose new features and changes
iseahound
Posts: 408
Joined: 13 Aug 2016, 21:04
GitHub: iseahound

Given two numbers generate a number that is not one of the two numbers

03 Apr 2019, 18:07

A bit of an interesting puzzle. The most obvious solution would be to average the two numbers and add 1. But what's the best way to generate a unique looking number?

For some background: Windows stores bitmaps top down or bottom up. So I'll be writing a short snippet that sets the top left pixel, and check if that changes the top left pixel or the bottom left pixel. The value to set the pixel to should be different from the existing colors.
Helgef
Posts: 3720
Joined: 17 Jul 2016, 01:02
Contact:

Re: Given two numbers generate a number that is not one of the two numbers

07 Apr 2019, 03:09

The most obvious solution would be to average the two numbers and add 1.
This would obviously not work though, i.e, for -1, 1
But what's the best way to generate a unique looking number?
Disregarding 37, all numbers are equally unique.

Code: Select all

something_else_than(a, b){ ; for integers
	return a && b ? 0 : max(a, b) + 1
}

Regarding bitmaps, I have some vague memory of the bitmaps' orientation being distinguished by them having negative or positive height.

Cheers.

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 6 guests