Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2015-02-26 22:11:27

goeyfun
Member
From: Mighty Japan
Joined: 2015-02-18
Posts: 667

CURVE or STRAIGHT

don't think about something else that isn't related to this topic //forums.everybodyedits.com/img/smilies/tongue

anyway, how  can i distinguish a player is doing a straight line or curve line?
way 0:
#define x1 as the min(allblockplacement.x)
#define x2 as the max(allblockplacment.x)
#define y1 as the min(allblockplacement.y)
#define y2 as the max(allblockplacment.y)
measure x2-x1 && y2-y1
if any of the value exceeds 1 than its not a straight line.
HOWEVER, when the user make turns, the bot thinks its a straight line

what is a better way to do so?


*ths solves the straight line bug in eetc


Ug3JzgO.png

Offline

#2 2015-02-26 23:03:43

TiKen
Member
Joined: 2015-02-24
Posts: 298

Re: CURVE or STRAIGHT

What are the "allblockplacment" thingy ?

Offline

#3 2015-02-26 23:36:03

Different55
Forum Admin
Joined: 2015-02-07
Posts: 16,574

Re: CURVE or STRAIGHT

My guess would be an array of all blocks that a user has placed.


"Sometimes failing a leap of faith is better than inching forward"
- ShinsukeIto

Offline

#4 2015-02-26 23:37:00

Hexagon
Member
Joined: 2015-04-22
Posts: 1,213

Re: CURVE or STRAIGHT

Compute the distance from each block that they draw to a point on the map (preferably the center.) If the data points have a standard deviation that deviates greatly from the mean of the distance from each individual point from the anchor point, then the line is probably not straight.

Offline

#5 2015-02-27 02:30:31

TiKen
Member
Joined: 2015-02-24
Posts: 298

Re: CURVE or STRAIGHT

Hexagon wrote:

Compute the distance from each block that they draw to a point on the map (preferably the center.) If the data points have a standard deviation that deviates greatly from the mean of the distance from each individual point from the anchor point, then the line is probably not straight.

Won't work:
-draw a circle around the anchor point: mean ~= r / std ~= 0
-draw a line going through the anchor point: the std will probably be great

If you know in which order the blocks as been placed: compute a crude delta vector for each blocks [ x(t+1)-x(t) and same for y], smooth the values [e.g.: x(t) = (x(t-1) + x(t) + x(t+1))/3  you can vary the size of the filter] then std, and if std is too big, then you have a curve

However, a slight curve might not be detected.

Offline

#6 2015-02-27 03:28:36

Hexagon
Member
Joined: 2015-04-22
Posts: 1,213

Re: CURVE or STRAIGHT

TiKen wrote:

Won't work:
-draw a circle around the anchor point: mean ~= r / std ~= 0
-draw a line going through the anchor point: the std will probably be great

Oops. Forgot about circles (which would be a way of cirmventing it.) You're right about that.

Possibly if the bounding box was computed for an interval of "artwork" and to check how much of that bounding box is filled with the blocks. So for example computing the bounding box of a perfectly straight line means that the entire bounding box will contain that line, and it will be filled 100% with those blocks. However if a circle or a curved line is drawn, the bounding box will have to encompass the entire curve, therefore the empty blocks to filled blocks ratio within the bounding box can determine whether it is a curve or not.

The problem is is that if a square is drawn, it might believe it is a curve because it takes up a lot of empty space. Either:
(a) two bounding boxes are computed, and the remainder is calculated towards the empty block amount. The second bounding box would be the largest bounding box that can be drawn within the first bounded box.
(b) the time interval in which the bounding box is calculated decreases, so that when one line is drawn, the bounding box is calculated and then for the other line the bounding box is calculated for that line, and is independent of the other one.

Offline

#7 2015-02-27 13:45:55

Zumza
Member
From: root
Joined: 2015-02-17
Posts: 4,645

Re: CURVE or STRAIGHT

If the next blog direction is : N or S or W or E then its straight.
If the next block direction is : NE or NW or SE or SW then its curve.


Everybody edits, but some edit more than others

Offline

#8 2015-02-27 14:18:48

goeyfun
Member
From: Mighty Japan
Joined: 2015-02-18
Posts: 667

Re: CURVE or STRAIGHT

Zumza wrote:

If the next blog direction is : N or S or W or E then its straight.
If the next block direction is : NE or NW or SE or SW then its curve.

Ki4fSsW.png
...

btw, i haven't learnt std.. but Hexagon& Tiken& Zumza, thanks reli much
gonna learn more abt it


Ug3JzgO.png

Offline

#9 2015-02-27 16:04:05

TiKen
Member
Joined: 2015-02-24
Posts: 298

Re: CURVE or STRAIGHT

Xi being a set of variable X

Standard deviation:
Std(Xi) = sqrt(mean_j( (Xj - mean_i(X_i))² ))

Meaning: it's the mean of [the euclidean distance from each variable to the mean of [those variables]] =P
It represent the precision of a set of variable, while the mean would represent its accuracy

Offline

TiKen1425049445477260

Board footer

Powered by FluxBB

[ Started around 1715041537.4352 - Generated in 0.033 seconds, 10 queries executed - Memory usage: 1.47 MiB (Peak: 1.6 MiB) ]