It looks like you're using an Ad Blocker.
Please white-list or disable AboveTopSecret.com in your ad-blocking tool.
Some features of ATS will be disabled while you continue to use an ad-blocker.
originally posted by: DeReK DaRkLy
This is not for a school project or anything important, I'm just an amateur video game hobbyist. So here's the deal...
I'm trying to design a top-down view of a city (think Grand Theft Auto 1) and I want to connect road pieces based on randomly generated road maps.
I only need the roads to connect at right angles, so they will only be going in the 4 cardinal directions.
In order for my program to know which piece (curves, straights, intersections, etc) to attach to its neighbor, I need to assign one of 4 identifying numbers - one for a neighboring piece of road to the North, one for South, one for East and one for West.
However, in order for this to work, no 2 totals (ranging fom 2 to four digits) can repeat against another total.
For example 10, 20, 30 and 40 don't work because 10+40 as well as 20+30 both equal 50.
So what are 4 magical digits that won't give repeating totals?
Any takers? =)
originally posted by: CountZero00
So for your example, if A = 1, B = 2, C = 4, D = 8, you would have these totals:
a+b = 3
a+b+c = 7
a+b+c+d = 15
a+b+d = 11
a+c = 5
a+c+d = 13 (this is the one I gave above)
a+d = 9
b+c = 6
b+c+d = 14
b+d = 10
c+d = 12
originally posted by: Maxatoria
A good bit of comp-sci is learning about various number bases such as binary/octal/hex/decimal and how to mangle them to give a result that is actually worth something.
That maths of random numbers gives a whole different conversation and unless you have one of those particle decay generators it could get messy.