[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Hey /g/, I just invented a problem I needed to solve for a project.

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 55
Thread images: 3

File: challenge08.jpg (24KB, 452x220px) Image search: [Google]
challenge08.jpg
24KB, 452x220px
Hey /g/, I just invented a problem I needed to solve for a project. See how fast you can solve it.

Given a point on a grid, and an integer x, how many points are at a manhattan distance of x from the point?
>>
>>57304658
it would be nice if you defined what a manhattan distance is you retard
>>
>>57304658
Literally just trace the edges of the grid to points and count.

Unless you know the grid is following a pattern somehow and you're not hitting the boundaries (in which case you trivially can just calculate how many points there should be by calculating how many points you got according to the pattern at that distance that you'd have on an infinite grid, and then subtracting those outside the actual boundaries).

It's like this is your simple homework, and you're too stupid to do it?
>>
>>57304691
Not same anon, but:
https://en.wikipedia.org/wiki/Manhattan_distance
>>
>>57304780
clicking a link is way too much work or else I would have googled it myself.
>>
>>57304691
>it would be nice if you defined what a manhattan distance is you retard
are you for real?

first: you could just google it.
but second: you almost definitely don't know enough to help the OP.

as for OP, this sounds like a homework assignment that you "invented"
>>
>>57304800
how can it be harder than posting your indignation about your own ignorance twice now?
>>
>>57304658
as long as grid doesnt have an borders
x*4
>>
>>57304817
>>57304808
if OP needs help on something, he could have given all the parameters that is useful to helping him. I simply find it more fun to bitch about things than googling things to help someone who doesn't earn the help by providing as much info as possible.

It's the same reason retards expect you to solve their computer problems without telling you what the problem they are actually experiencing is.
>>
>>57304658
Wouldn't there be an infinite number of points semantically?
>>
>>57304878
Stop posting please, it is embarrasing
>>
>>57304878
he did give all the parameters. he just used vocabulary you didn't understand, which is a good signal that you don't know enough about this domain to help at all.
>>
>>57304895
stfu i like his attitude if you dont why are you here replying to him
>>
>>57304908
You have to be 18+ to visit this website.
>>
>>57304907
>>57304895
Vocabulary isn't everything retards, maybe one day you make it out of your faux academic pretentious world and realize how the real world works and how different fields often share the same concepts but different jargon.

Pretending to be smart just because you know a definition is the epitome of pretentiousness that I have no reason to follow. Maybe your mom thinks you are super smart because you say things people don't understand but to most people, you just lack the communication skills to get what you actually want.
>>
>>57304888
or just 1 point, "given a point"
>>
>>57304916
im 20
>>
>>57304945
Easy there friend. You are assuming a lot and most likely projecting insecurities onto anons on 4chan. We're all just here to have a good time.
>>
>>57304945
And then we do which of these three?
1. Know all fields and insert proper explanations mapping jargon to each other with each problem we state.
2. Insert terminology explanations for everything that *someone* might not know.
3. Let people google what ever the fuck they don't know.
>>
>>57304955
Then act like it.
>>
>>57304945
all i said was that if you don't know the right words, you probably don't know the domain in the first place, and you probably can't give any real help.

instead you're probably more likely to get into an argument with a bunch of people who are just trying to help the OP avoid explaining a bunch of rudimentary shit to someone who evidently never took any lower div CS or math courses.
>>
>>57305009
i act however i want
especially on a pseudo anonymous imageboard
>>
>>57305045
at least don't act surprised and indignant when we all call you a retard if you choose to act like a retard.
>>
>>57305054
what part of
>im 20
sounded surprised to you?

>>57305030
english may or may not be his native language and people usually dont know the geometrical terms of the foreign languages they learn
its called taxi distance in many languages
>>
File: 1477667122844.jpg (27KB, 600x330px) Image search: [Google]
1477667122844.jpg
27KB, 600x330px
>>57304658
How do I convert regular seconds to microwave time?
>>
>Guys I just inventend one of the oldest problems ever
Pathfinding was solved decades ago
>>
>>57305072
With a manhattan distance of 1 there would be 4 points, N E S and W. With a distance of 2 there would be 12 points total. Too drunk/stupid to think of the coorelation but should be simple. No reason it shouldn't hold up
>>
>>57305076
With a microclock, duh.
>>
>>57305109
>>57305072
Meant to reply to OP not you
>>
>>57305072
the whole rest of your posts look surprised and bitchy about us trying to explain something simple to you

>its called taxi distance in many languages
which languages call it "taxi distance" and known so much more predominantly as such that the more common "manhattan distance" has never come up?

also i just googled "taxi distance" and all i'm finding are taxicab services offering to estimate fares.

look, the point is you don't know this topic. if you did, you'd know the term. it's fine to not know stuff. but it's not fine to be bitchy to the OP for not explaining what simple, googleable terms mean.
>>
>>57304658
>Highschool math
2x^2 + 2x
>>
>>57305125
not every anon youre replying to on this thread is the same
i know the topic and i answered already before you and that bitchy anon started arguing
>>
8x^2-16x+12

I think
>>
>>57305158
Instead of learning something from this encounter you are going to duck out to protect your non-existant reputation.

Admitting you were just being dumb is the only way to come out as a winner here.
>>
>>57305190
>winner
>on anime image board
yea ok
meanwhile you didnt post an answer for ops question and i did
>>
>>57305210
Which answer was yours?
>>
>>57305218
>>57304820
>>
The point is irrelevant if the lattice is infinite.
For a distance of 1, there's 4 points at this exact distance, 2 can there's 8 points, and so on. The total number of point reachable at distance x is the number of points exactly at distance x - 1.

int reachable_total(int dist)
{
return ((1 << (dist + 2)) - 1) & ~3;
}

reachable_total(1):
1 << 3 = 8
8 - 1 = 7
7 & ~3 = 4

reachable_total(2):
1 << 4 = 16
16 - 1 = 15
15 & ~3 = 12

reachable_total(3):
1 << 4 = 32
32 - 1 = 31
31 & ~3 = 28
>>
>>57305227
Okay. Think about finding the distance by traversing city blocks. If you can make one move you are limited to North East West or South. With two moves you can make all the moves you could before plus one. You can move 3 directions from the new point without going back over your old path.

This means that there is a nonlinear relationship. There would be y=12 total points on with x=2 moves. Therefore y != 4x.

I posted >>57305176 but I am not a math major and am relying on faded High School math memories here. I think it is correct unless I am misunderstanding some semantics of the problem.
>>
>>57305236
>7 & ~3 = 4
>15 & ~3 = 12
>31 & ~3 = 28
Please explain the justification for edginess of which why you just don't use subtraction?
>>
File: civ5.jpg (422KB, 554x774px) Image search: [Google]
civ5.jpg
422KB, 554x774px
What do I win?
>>
The answer is literally 4x+1
does not take a computer to figure that out
>>
>>57305304
Where are you getting the +1 from?
>>
>>57304658
The answer is yes.
>>
>>57305315
>>57305304
>where are you getting the +1 from
Also curious
>>
If it's the number of points exactly x Manhattan distances away it's 4x.

If it's the number of points within x Manhattan distances it's 2x^2+2x
>>
>>57305284
>le "people who use bit operations are edgy hakers xDDD" meme

And I used these operators just because it's easier to visualize how it works, if you just see the values as masks.
>>
>>57305337
If we include that starting point as a point within x distance then it becomes 2x^2+2x+1
>>
>>57305337
>>57305349
Can you explain your reasoning behind 4x?
>>
>>57305282
i assumed going backwards like making a U shape would return a distance of 1 even thought you travel 3
what youre described is all the possible different movements many of them would end up in the same point
>>
>>57305367
Ah okay yeah. I think you are right then. So a move of S->E would result in a taxicab distance of 1, a move of S->S would be a distance of 2, a move of S->E would be 1. So wouldn't there still only be 4 points at a manhatten distance of 2 then?
>>
>>57305390
S>E is 2 distance
S>E>N is 1 distance
>>
>>57305362
Not him but think about it like this
Stretch a line between (x - d) to (x + d), then every time you move one point, you have one point above and one point below the line
>>
>>57305401
>>57305405
Alright, makes sense now. Really simple misunderstanding but I have been short-circuiting all day anyway. Have a goodn anons
>>
>>57305362
Just draw a single quadrant at x = 1, you get one end point.

_

Now draw it with x = 2, you get 2 end points.

_|_


and x = 3, you get 3 end points.

  |_ 
_|_|_


Obviously it's increasing at a 1:1 ratio to x, because you've only accounted for one quadrant you need to multiply this by 4 however.
Thread posts: 55
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.