# Algorithms

Robo Home | Changes | Preferences | AllPages

This just seems like a logical page for the wiki to have. Not everything you can do is covered in Java API. Also, when things are it's useful to know which method to pick for your problem. It also gives me a place to ask stuff :P. -- Kuuran

#### Algorithm Questions

1) Given a plot of points and a polygon, an efficient method of finding where to place the polygon to encompass the maximum number of points?

#### Useful Algorithms

1) I've found this useful for making useless melee movements: Convex Hull. It's well described, but basically as follows:

Given a set of points:

```  1) Select the leftmost point
2) Sort remaining points by bearing (counter-clockwise) to leftmost point
3) Add these three points to the polygon
4) For every point after 3:
1) Calculate the angle between the second last point in the polygon, the last point in the polygon and this point
2) Remove the last point from the polygon until the angles makes only "left" turns
3) Add the point to the polygon
```

The resulting polygon is the smallest convex polygon that includes all the points given.

Robo Home | Changes | Preferences | AllPages
{"ft_lang_label":"__label__en","ft_lang_prob":0.89375764,"math_prob":0.93079484,"size":1055,"snap":"2020-34-2020-40","text_gpt3_token_len":239,"char_repetition_ratio":0.16079924,"word_repetition_ratio":0.0,"special_character_ratio":0.22085308,"punctuation_ratio":0.07804878,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98409027,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-09-24T18:38:27Z\",\"WARC-Record-ID\":\"<urn:uuid:f85cbec8-6f9a-4f5b-adee-4020ec637b10>\",\"Content-Length\":\"3124\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:37b8fc9c-eb81-4c40-843d-72479c3f5c34>\",\"WARC-Concurrent-To\":\"<urn:uuid:f1e4bd9a-aa89-4989-86aa-cd827218355a>\",\"WARC-IP-Address\":\"95.217.7.6\",\"WARC-Target-URI\":\"http://old.robowiki.net/cgi-bin/robowiki?Algorithms\",\"WARC-Payload-Digest\":\"sha1:6OYF6476PNJ7A5B3TPHR54ZEK73LAGSP\",\"WARC-Block-Digest\":\"sha1:ZS56J435DWGLTXVQJ2WJBDREKASTM7P4\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-40/CC-MAIN-2020-40_segments_1600400219691.59_warc_CC-MAIN-20200924163714-20200924193714-00683.warc.gz\"}"}