text:
Is my name official?
Introduction
As ToonAlfrink says: "Me thinks there aren't enough easy questions on here that beginners can attempt!". So the task is very simple. Given a string, output a truthy or falsy value whether the name is official or not.
A name is "official" if it is a single title-case word, that is:

If the first letter is capitalized (not official: adnan)
If the other letters are not capitalized (not official: AdNaN)
If the name doesn't contain any non-alphabetic characters (not official: Adnan123, Adnan!)
If the name consists of just one word (not official: Adn an, Adn An)
If the name has more than one character (not official: A)

Rules

You may provide a function or a program
This is code-golf, so the submission with the least amount of bytes wins!
Note: To simplify things, names like Mary-Ann are in this challenge not official.
Assume that there are no leading whitespaces in the name.
Assume that only the printable ASCII characters (32-126) are used in the names

Test cases
Input: Adnan
Output: True

Input: adnan
Output: False

Input: AdnaN
Output: False

Input: Adnan123
Output: False

Input: Adnan Adnan
Output: False

Input: A
Output: False

Input: Mary-Ann
Output: False

Leaderboard

/* Configuration */

var QUESTION_ID = 67554; // Obtain this from the url
// It will be like http://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 34388; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "http://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "http://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery(''+lang+'').text();

    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}

<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

So my name's not official? I'd better change it then.

@ETHproductions If we're using this logic, Lololololololololololol is an official name :)

I don't think ETHproductions would be official, since there are capitalized letters beyond the first one. What's the definition of an "alphabetic character"? Is it only the 26 letters of the English alphabet? Or also letters from other languages? Like German names with umlauts, or French/Spanish names with various accents?

@RetoKoradi Only the basic Latin characters are used

That doesn't really answer the question. Which is it: "you may assume the name doesn't contain accented letters", or "names with accented letters should yield False"?

What, your name consist of only one syllable? Then is it first name or last name? How about McDonald? Is it official

@Mauris Accented letters won't be even used in the name

Just because the explanation doesn't quite fit the challenge doesn't mean the challenge is wrong. It means the explanation is wrong. You can criticize the explanation once you come up with a better one, and only then.

As a slightly offbeat Canadian digression, a professor I know wouldn't be happy with your "official" criteria: Robert Smith?. His name actually does have that question mark. Also, Sahaiʔa.

Are regexes allowed?

@FarhanAnam Yes

@Adnan And are using external frameworks allowed? Like .NET  (I guess it has to be for C#). And will the code need to include the imports/usings?

@FarhanAnam External frameworks are allowed. imports and using needs to be included in the code

This made trying to find all posts started by you significantly more difficult.

Is the name guaranteed not to be empty?

Pyth, 16 13 12 bytes
Thanks to @Thomas Kwa for reminding me about titlecase.
&qzr@GrzZ3tz

Test Suite.
&              Boolean and operator
 qz            Equality test on input
  r    3       Titlecase operator
   @G          Setwise intersection with the alphabet
    rzZ        Input to lowercase
 tz            All but the first character of the input

Retina, 13 bytes
^[A-Z][a-z]+$

Try it online | Test suite (The output 0 means none of the strings matched, which is expected.)
When Retina is only provided with a single line of code, it outputs the number of times the expression matched the input string, so it will output 1 (truthy) if it matches and therefore is an official name and 0 (falsy) if it's not.
Breakdown
^       The beginning of the string
[A-Z]   One uppercase letter
[a-z]+  One or more lowercase letters
$       The end of the string

Looks like we need character classes for letters. ;)

TeaScript, 12 bytes
xO`A-Z][a-z`

Abuses the O function.
Try this online
Test Suite
Explanation
The O function makes this:
x O   `A-Z][a-z`
x.O(/^[A-Z][a-z]+$/)

Then, the O function checks if the regex matches x.

Alternatively, a  TeaScript 3 answer at 7 bytes:
xO/\A\a

Ahahaha, nice one. At some point while I was working on the Japt interpreter, I used this trick with the isChar function you added. But you may want to explain in more detail for those not in the know.

Ooooooh, I like the new regex features!

JavaScript (ES6), 26
n=>/^[A-Z][a-z]+$/.test(n)

By: Edcsixtyfive

f=n=>/^[A-Z][a-z]+$/.test(n)

console.log=x=>O.textContent+=x+'\n'

;['Adnan','adnan','AdnaN','Adnan123','Adnan Adnan','A','Mary-Ann']
.forEach(t=>console.log(t+' '+f(t)))

Darn, you beat me to it. You also outgolfed my version by 5 bytes.

One byte less: n=>n.match\^[A-Z][a-z]+$``

@user81655 an array as a truthy value is too forced IMHO

@edc65 It is valid though.

For only 4 bytes more you get ES5 compliance: /./.test.bind(/^[A-Z][a-z]+$/)

@CRDrost post it as a ES5 solution (pls with an explanation)

Wrote this exact code before even looking at the answers, knowing full well someone else would have already done it lol... Well done =)

Does /^[A-Z][a-z]+$/.test work? i.e. n=/^[A-Z][a-z]+$/.test;n(str)?

@NoOneIsHere nice idea, worth a try, but it does not

Python, 59 58 bytes
I'm sure there's no real way to beat the Retina version, since this is basically just that within Python. But I think this is my first submission ;)
import re,sys;print(re.match('[A-Z][a-z]+$',sys.argv[1]))

It's a very odd truthy value:
(test2)wayne@arglefraster ~/programming/inactive/golf/67554
⚘ python golf.py AdNan                                                                                $? 148  %# 3  10:06:36
None
(test2)wayne@arglefraster ~/programming/inactive/golf/67554
⚘ python golf.py Adnan                                                                                %# 3  10:06:40
<_sre.SRE_Match object at 0x7feefea7f440>
(test2)wayne@arglefraster ~/programming/inactive/golf/67554
⚘ python golf.py "Adnan Banana"                                                                                %# 3  10:06:47
None

(And it does require "" around strings with spaces in it, if passed via the shell)

^ is not needed as re.match() only matches at the beginning of string.

@manatwork nice! Another byte shaved :) I could save another byte with the closing paren, using Python2

@WayneWerner: that's why you should give the Python version :) I think Python 2 and Python 3 are kind of different languages, at least for codegolf.

If you use a anonymous lambda instead of a whole program, you get 45 bytes: lambda s:re.match('[A-Z][a-z]+$',s) import re

@movatica Immediately what I was thinking. You could even use from re import* for less bytes

@MilkyWay90: nope, in this case this costs more than it saves: re. is 3 bytes vs from * which counts 6.

@movatica Oh, whoops!

Java, 53 bytes
boolean b(String a){return a.matches("[A-Z][a-z]+");}

You can use a lambda: s->s.matches("[A-Z][a-z]+")

Python, 50 45 43 41 bytes
lambda s:s.isalpha()*s.istitle()*len(s)>1

Returns True if it's an official name or False if it's not.

Rules of codegolf state, that you don't need to take the f= into account, saving two bytes. Also, (len(s)>1) saves 5 bytes over s[1:].islower(). :)

VB6, 48 bytes
Function f(i):f=i Like"[A-Z][a-z]+":End Function

BotEngine, 203 180 29x6=174
v ABCDEFGHIJKLMNOPQRSTUVWXYZ
>ISSSSSSSSSSSSSSSSSSSSSSSSSSF
v <<<<<<<<<<<<<<<<<<<<<<<<<<
 Tabcdefghijklmnopqrstuvwxyz
> SSSSSSSSSSSSSSSSSSSSSSSSSSF
^E<<<<<<<<<<<<<<<<<<<<<<<<<13)b|=b|=!b&&c>90|c<65?1:2&&d++&&c<97|c>122?4:2;printf("%d\n",b<3&&d>1);}

Try It Online
main(c,b,d)
{
    b=d=0;
    while((c=getchar())>13)
    {
        // Twiddle bits, 1<<0 for first character and 1<<3 for subsequent
        b|=!b&&c>90|c<65?1:2; // check first character is valid
        b|=d++&&c<97|c>122?4:2; // check later characters are valid
    }
    // If all OK b == 2, if either of above are wrong, b >= 3 due to
    // extra bits. Also, d should be > 1 for name length to be valid.
    printf("%d\n",b<3&&d>1);
}

Ruby, 28 bytes
p (gets=~/^[A-Z][a-z]+$/)!=p

-2 bytes( thanks to manatwork )

Take a look at Fábio Perez's p related tips in Tips for golfing in Ruby.

Simpler and shorter:  p !!gets[/^[A-Z][a-z]+$/]

20 using -n, p~/^[A-Z][a-z]+$/!=p. ATO

05AB1E, 11 7 6 bytes
á™Q×¦Ā

-4 bytes thanks to @Grimy.
Try it online or verify all test cases.
Explanation:
á       # Only leave the letters of the (implicit) input
        #  i.e. "Adnan" → "Adnan"
        #  i.e. "A" → "A"
        #  i.e. "aDNAN" → "aDNAN"
        #  i.e. "Adnan123" → "Adnan"
 ™      # Titlecase it
        #  i.e. "Adnan" → "Adnan"
        #  i.e. "Adnan" → "A"
        #  i.e. "aDNAN" → "Adnan"
  Q     # Check if it's still equal to the (implicit) input
        #  i.e. "Adnan" and "Adnan" → 1 (truthy)
        #  i.e. "A" and "A" → 1 (truthy)
        #  i.e. "aDNAN" and "Adnan" → 0 (falsey)
        #  i.e. "Adnan123" and "Adnan" → 0 (falsey)
   ×    # Repeat the (implicit) input that many times
        #  i.e. "Adnan" and 1 → "Adnan"
        #  i.e. "A" and 1  → "A"
        #  i.e. "aDNAN" and 0 → ""
        #  i.e. "Adnan123" and 0 → ""
    ¦Ā  # Remove the first character, and check that it's non-empty
        #  i.e. "Adnan" → "dnan" → 1 (truthy)
        #  i.e. "A" → "" → 0 (falsey)
        #  i.e. "" → "" → 0 (falsey)
        # (which is output implicitly as result)

7 bytes: á™Qиg2@

@Grimy Thanks, but the и should be × instead. By using и you create a list with the string in it, so the length of that list is always 1 regardless of the string length.

grep, 16 bytes
This is the pattern:
[A-Z][a-z]+

If you use the -E and -x and -c switches grep will print a count of matching input lines. So if you give it one line you get a 1 or a 0. I think that's how this place works.
The pattern is 11 chars, the whole command line is 23. I've seen people use sed scripts without the command so I don't know what is what. But, it reads stdin, and so you can just type at it. Here's echo:
for a in Adnan adnan Ad\ nan
do  echo "$a" | grep -cxE \[A-Z]\[a-z]+
done

1
0
0

@Doorknob - seems fair enough to me. thanks very much. which hat did you guess?

I figured out Hairboat's Revenge. :P

Stop me if (as is quite probable) I'm wrong but you can use grep -Exc so you don't need to count as many bytes for the switches.

@Neil - i dunno if you're wrong. i have really no idea - have a look at the edit history.

C# 4, 89 bytes
My first attempt at Code Golf. Here it comes:
bool o(string i){return System.Text.RegularExpressions.Regex.IsMatch(i,"^[A-Z][a-z]+$");}

See it in action at Dot Net Fiddle.

If you use C# 6, you can make it a bit shorter: bool o(string i)=>System.Text.RegularExpressions.Regex.IsMatch(i,"^[A-Z][a-z]+$");

Mathematica 10.1, 46 bytes
LetterQ@#&&#==ToCamelCase@#&&StringLength@#>1&

Uses one less byte than the standard regex solution. It does three checks. LetterQ@# ensures that the string is entirely composed of letters, and StringLength@#>1 invalidates single-letter strings. #==ToCamelCase@# makes less sense, however. ToCamelCase is an undocumented function I found that takes an input string AndOutputsItLikeThis. Since there is only one word, it will capitalize the first letter, so we check if the string is equal to that.

Is ToCamelCase new in 10.3? Doesn't seem to work in 10.2.

@murphy, it works for me in 10.1. What do you get with ToCamelCase["foo bar baz"]?

Ok, I can confirm that it works in 10.1. However, in 8.0, 9.0, 10.0 and 10.2 the function is not defined (your test case returns ToCamelCase[foo bar baz]). Strange! Maybe someone can check 10.3?

bash/zsh/ksh, 25 bytes
[[ $1 =~ ^[A-Z][a-z]+$ ]]

To actually use this, make a file with it as the only line and make the file executable; executable files not recognized as a known binary type are treated as shell scripts (for /bin/sh specifically).
$ printf '[[ $1 =~ ^[A-Z][a-z]+$ ]]' >f
$ chmod +x f
$ wc -c f
25 f
$ for x in 'Adnan' 'adnan' 'AdnaN' 'Adnan123' 'Adnan Adnan' 'A' 'Mary-Ann'; do f "$x" && echo 1 || echo 0; done
1
0
0
0
0
0
0
$

This works fine in bash, ksh and zsh, but has no chance to work in standard POSIX sh or the compatible dash and yash. To avoid confusion, I suggest to change the answer's title.

Use printf instead of echo to create the file and you’ll get 25 bytes.

Good points, both of you; both applied.

MATL, 18 bytes
The current version (4.0.0) of the language is used.
This applies the same regular expression as NinjaBearMonkey's answer:
j'^[A-Z][a-z]+$'XX

The output is the string (which is truthy) if it's an official name, and nothing (which is falsy) if it's not.
Examples
>> matl
 > j'^[A-Z][a-z]+$'XX
 >
> December
December
>>

>> matl
 > j'^[A-Z][a-z]+$'XX
 >
> ASCII
>>

Haskell, 61 bytes
f(h:t@(_:_))=elem h['A'..'Z']&&all(`elem`['a'..'z'])t
f _=1<0

One byte fewer

Several more down. You could also use that technique for the other test to be more efficient, but it's the same number of bytes.

Gema, 17 characters
\B<K1><J>\E=1
*=0

Sample run:
bash-4.3$ echo -n 'Adnan' | gema '\B<K1><J>\E=1;*=0'
1

bash-4.3$ echo -n 'adnan' | gema '\B<K1><J>\E=1;*=0'
0

bash-4.3$ echo -n 'Adnan123' | gema '\B<K1><J>\E=1;*=0'
0

IA-32 machine code, 19 bytes
A function that receives the pointer to a null-terminating string in ecx and returns 0 or 1 in eax (according to the fastcall convention).
Hexdump of the code:
6a 20 58 32 01 74 0a 41 2c 61 3c 1a b0 00 72 f3 c3 40 c3

In assembly language:
    push 32;
    pop eax;

myloop:
    xor al, [ecx];
    jz yes;
    inc ecx;
    sub al, 'a';
    cmp al, 26;
    mov al, 0;
    jb myloop;
    ret;

yes:
    inc eax;
    ret;

The first byte of the input name has its 5th bit flipped (xor with 32) to convert it from capital case to small case. This loads 32 into eax, using 3 bytes of code:
    push 32;
    pop eax;

To check whether the byte is a small letter:
    sub al, 'a';
    cmp al, 26;
    jb myloop;

If not, this code falls through. To return 0 in this case, it puts 0 in al before doing the conditional jump:
    sub al, 'a';
    cmp al, 26;
    mov al, 0;
    jb myloop;

The 0 in al also serves as a xor-mask (or absence of it) for the following bytes of the input name.
A successful exit is when it encounters a zero byte, which stays zero after the xor:
    xor al, [ecx];
    jz yes;

It assumes that the input name is not empty. I guess it's a reasonable assumption about a name (not an arbitrary string)!

Java, 28 bytes
n->n.matches("[A-Z][a-z]+")

Uses regex to make sure the string consists of an uppercase character followed by at least one lowercase character.
-1 bytes thanks to Benjamin Urquhart

You can drop the semicolon

@BenjaminUrquhart oh right, thanks

Vyxal, 8 bytes
Lċ?₍ǐǍ≈∧

Try it Online (with test cases)!
Potentially golfable. I swear there was a builtin for len(a)>1...
Assumes input is nonempty.
L        # Length of input
 ċ       # is not 1
  ?      # Push the input,
   ₍     # parallel apply...
    ǐ    # title case and
     Ǎ   # keep only alphabetic chars
      ≈  # is equal?
       ∧ # bitwise AND the length and ^

6 bytes (port of Kevin Cruijssen's 05AB1E answer)

Thunno 2 b, 5 bytes
Ịḟ=×ḣ

Port of Kevin Cruijssen's 05AB1E answer.
Explanation
Ịḟ=×ḣ  # Implicit input
Ị      # Remove non-alphabets from the input
 ḟ     # Convert this string to title case
  =    # Check whether it's still equal to the input
   ×   # Repeat the input this many times
       # (i.e. input if true, empty string otherwise)
    ḣ  # Remove the first character from this string
       # The b flag boolifies the resulting string,
       # checking that it is not empty
       # Implicit output

Screenshots

(click to enlarge)

k4, 39 bytes
{((*x)in .Q.A)&(&/(1_,/x)in .Q.a)&1<#x}

First char is upper, all others are lower, count greater than one.
E.g.:
  {((*x)in .Q.A)&(&/(1_,/x)in .Q.a)&1<#x}'("Adnan";"adnan";"AdnaN";"Adnan123";"Adnan Adnan";"A";"Mary-Ann")
1000000b

Seriously, 16 bytes
ú4,nÿ=)l1<)ù-Y&&

Hex Dump:
a3342c6e983d296c313c29972d592626

Try It Online
Seriously does not have regex support yet, so the best we can do is:
 4,n                               Push 4 copies of input
    ÿ=                             Check that it's equal to itself converted to titlecase
      )                            Put the boolean on the bottom
       l1<                         Check that it's longer than 1 character
          )                        Put the boolean on the bottom
           ù                       Convert it to lowercase.
ú           -Y                     Check that removing the lowercase alphabet empties it
              &&                   And all the booleans together

Ocaml, 231 216 197 166 bytes
let f n=let l=String.length n in if l=1 then 0 else let rec e=function 0->1|i->match n.[i] with('a'..'z')->e(i - 1)|_->0 in match n.[0]with('A'..'Z')->e(l - 1)|_->0;;

Example usage:
# f "Adnan";;
- : int = 1

# f "adnan";;
- : int = 0

# f "AdnaN";;
- : int = 0

# f "Adnan123";;
- : int = 0

# f "Adnan Adnan";;
- : int = 0

# f "A";;
- : int = 0

# f "Mary-Ann";;
- : int = 0

Ungolfed (with real function names):
let is_name name =
  let len = String.length name
  in if len = 1 then 0 else
  let rec explode_lower = function
    | 0 -> 1
    | i ->
      match name.[i] with
      | ('a'..'z') -> explode_lower (i - 1)
      | _ -> 0
  in match name.[0] with
  | ('A'..'Z') -> explode_lower (len - 1)
  | _ -> 0;;

You could actually save about 10% by using booleans instead of integers (bleh!) and replacing those bulky if … then 0 else  by … ||. And for that matter by using boolean operators instead of match and ranges, e.g. n.[0]>'@'&n.[0]<'['&e(l-1)

Swift 2, 116 bytes
Regex is so verbose in Swift that doing this is much shorter
func e(s:String)->Int{var c=0;for k in s.utf8{if(c==0 ?k<65||k>90:k<97||k>122){return 0};c++};return s.utf8.count-1}

This will return 0 or -1 (in the case of no input) for non-official names, and a number > 0 (which is equal to the length of the string - 1) if the name is official
Ungolfed
func e(s: String) -> Int{
    var c = 0
    for k in s.utf8{
        if(c == 0 ? k < 65 || k > 90 : k < 97 || k > 122){
            return 0
        }
        c++
    }
    return s.utf8.count - 1
}

SpecBAS - 39 bytes
SpecBAS handles regular expressions through the MATCH command. Output is 0 for false and 1 if true.
1 input n$:  ?MATCH("^[A-Z][a-z]+$",n$)

C#, 188 bytes
Regular expressions would have been the right way to tackle this, but here's an attempt without it.
bool O(string s){for(int i=1;i<s.Length;i++){if(char.IsUpper(s[i])){return false;}}if(char.IsUpper(s[0])&&s.All(Char.IsLetter)&&!s.Contains(" ")&& s.Length > 1){return true;}return false;}

Longhand
static bool O(string s)
{
    for (int i = 1; i < s.Length; i++)
    {
        if (char.IsUpper(s[i]) )
        {
            return false;
        }
    }
    if (char.IsUpper(s[0]) && s.All(Char.IsLetter) && !s.Contains(" ") && s.Length > 1)
    {
        return true;
    }
    return false;
}

Would love advice on how to make the lowercase check shorter, perhaps without the loop. I just started learning the language, and used this as practice, figured I'd share my result anyway.

Perl 5 -p, 18 bytes
$_=/^[A-Z][a-z]+$/

Try it online!

Perl 6, 17 bytes
{/^<:Lu><:Ll>+$/}

Returns a Match object if this is an official name and Nil otherwise.
Try it online!

You don't need the m

Japt, 9 bytes
Returns 1 or 0.
è"^%A%a+$

Try it

PowerShell, 29 bytes
"$args"-cmatch'^[A-Z][a-z]+$'

Try it online!
Does the same regex trick everyone else is using. Has to use case-sensitive match to properly do it at the cost of a byte.

J, 18 bytes
'[A-Z][a-z]+'&rxeq

Attempt This Online!
'[A-Z][a-z]+'&rxeq
              rxeq  NB. does the regex fully describe the string
             &      NB. bind the left argument to
'[A-Z][a-z]+'       NB. the Official™ regex

AWK, 15 bytes or 37 bytes (rule dependent)
Flexibly truthy
If you're allowed to define "truthy" as "non-empty string", then:
/^[A-Z][a-z]+$/

Try it online!
Strict truthy
If it needs to be something more consistent like 1 and 0, then:
{print match($0,/^[A-Z][a-z]+$/)?1:0}

Try it online!

C++, 73 bytes
Good old #define
#include<regex>
#define F(s)std::regex_match(s,std::regex("[A-Z][a-z]+"))

Code to test :
std::cout << F("Adnan") << '\n';
std::cout << F("adnan") << '\n';
std::cout << F("AdnaN") << '\n';
std::cout << F("Adnan123") << '\n';
std::cout << F("Adnan Adnan") << '\n';
std::cout << F("A") << '\n';
std::cout << F("Mary-Ann") << '\n';

JavaScript(ES6), 83 bytes
s=>s[0].match(/[A-Z]/)&&s.substr(1).match(/[a-z]/)&&!s.match(/[^A-Z]/i)&&s.length>1

Stax, 9 bytes
ü╡♫╒┤á╕◘▓

Run and debug it
Tests for complete match with regex "[A-Z][a-z]+".

Kotlin 98 bytes
x.length>1 && x.mapIndexed{i,c->if(i>0)c in 'a'..'z' else c in 'A'..'Z'}.sumBy{if(it) 0 else 1}==0

Way less boring than shorter:
x.matches(Regex("[A-Z][a-z]+"))

Try it online!

Welcome to PPCG! This code looks like a code snippet to me, but you need to provide a function or a full program, so you probably need to tack on that fun x(x:String)= part to your code for the actual score. Other than that, I'm sure there are a few spaces you can cut out, such as around &&, etc. to reduce your code size more!

As Java lambda were allowed, I have assumed that fun assignment were allowed too.

Lambdas in Java (and other languages) are allowed because variable assignment is not always necessary to run the function. Using the Java answer in this question as an example, list_of_inputs.stream().map(n->n.matches("[A-Z][a-z]+")) is valid code; instead of assigning it to a variable the lambda is simply passed directly into a function argument. It works because that block of code has everything it needs to run (which variables are inputs, etc.)

Anyways, I looked up how to use lambdas in Kotlin. You don't need to declare fun or the return type, just wrap it in {x:String->yourcode}! Try it online!

PHP, 51 bytes
<?=ucfirst($s=$argn)==$s&ctype_lower(substr($s,1));

Try it online!
No regex.  Input is STDIN, output to STDOUT is '1' for truthy and '0' for falsy.
$ echo Adnan|php -F p.php
1
$ echo adnan|php -F p.php
0
$ echo AdnaN|php -F p.php
0
$ echo Adnan123|php -F p.php
0
$ echo Adnan Adnan|php -F p.php
0
$ echo A|php -F p.php
0
$ echo Mary-Ann|php -F p.php
0
$ echo Mary-ann|php -F p.php
0

Python 2, 43 bytes
lambda s:len(s)>1==s.isalpha()<s==s.title()

Try it online!

Arturo, 28 bytes
$=>[match?&{/^[A-Z][a-z]+$}]

Try it

Lua, 29 bytes
s=...print(s==s:match'%u%l+')

Try it online!


text:
King of the Hill - Spacewar!

If you've ever played Spacewar!, you know it was a fun game. If you haven't, know this: it was (and is) one of the very first and most important computer games. And it's still fun! The clone I grew up on is this one, which is, apparently and unfortunately, Windows only. So I recreated it!
The KotH is hosted here: PPCG - Spacewar! King of the Hill. I encourage you to play as a human against at least one other bot to get a feel for how the game works.
The Game

One frame is 30 milliseconds (thus, about 33 frames per second).
The field is 800 pixels wide and 600 pixels tall.
The field is toroidal, meaning that spaceships and missiles that move outside of the field reappear on the opposite side.
There are two spaceships, red and blue.

Red is positioned at x=50 and random y between 50, (field height - 50) pixels.
Blue is positioned at x=(field width - 50) and random y between 50, (field height - 50) pixels.
Both face x = (field width)/2.

The available controls are:

Turn left - 5 degrees per frame counterclockwise.
Turn right - 5 degrees per frame clockwise.
Fire missile - travels at an extra 10 pixels per frame in addition to the velocity of the ship, in the direction the ship was pointing.
Fire engine - accelerates the spaceship at 0.30 pixels per frame in the direction the spaceship is pointing.
Hyperspace jump - teleports to some random coordinates in the field, with a 25% chance of exploding. These random coordinates may be on top of the sun.

The maximum speed for ships is 15 pixels per frame under engine power and 40 pixels per frame when gravity-boosted.

When traveling faster than 15 pixels per frame, engine thrust may only change direction or slow down.

Regarding missiles:

Missiles travel in a straight line.
Missiles may be fired at a maximum rate of 1 per 0.1 seconds.
Missiles have a lifetime of 2.25 seconds.
Ships have a maximum of 20 missiles each.
Missiles are point particles internally.

There is a sun in the very center that is extremely hazardous to your ship. The slightest contact is fatal. This sun also destroys missiles.
The sun has gravity. The resultant acceleration is 5000/(distance^2) pixels/frame^2, where distance is in pixels. Spaceships and missiles are affected.
Both ships have three strike zones: the nose, the left wing, and the right wing.

A hit on the nose is instant death.
A hit on either wing reduces the spaceship's turn rate and engine acceleration by half.
If both wings are destroyed, the spaceship cannot be maneuvered and can only fire missiles.

Ships may collide with each other.

A nose-nose impact is fatal for both ships.
A nose-wing impact destroys the wing.
A wing-wing impact destroys both wings.

Dead ships are solid and frozen until they explode 1 second later.
After at least one ship has died, the field is reset 3 seconds later. Until then, the sun and any remaining missiles are still hazardous.

The original game also has deadly and indestructible asteroids, but I won't include those.
The Rules

Your bot must be written in JavaScript.
Your bot should limit its decision to about 10 milliseconds. If I notice consistent lag because of your bot, I'll disqualify it and let you know so you can fix it.
Bots will have access to the following:

Field width and field height
Sun position and radius
The position, rotation, velocity, shape, missile stock, and in-hyperspace status of both ships
The position and velocity of all missiles

When prompted, your bot should return a list of strings.

These strings should be one of the following: turn left, turn right, fire engine, fire missile, hyperspace. Any other string will be ignored.
If there are any duplicates, only the first will be noted.
hyperspace takes precedence over all others.
turn left and turn right at the same time will have no effect.
fire engine will have no effect if the ship only has the nose or is dead.
fire missile will have no effect if a missile was fired too recently.

In a change from the usual, your bot is allowed to exploit the behavior of other bots. I want to encourage a metagame.

Bots may not emulate other bots. (I.e., no mind-reading.)
Bots may not set any variables used by the game and physics code. (I.e., no cheating.)

Bot Implementation Details
I will be storing your bot in its own JavaScript file that is automatically included, with the filename bot_<name>.js. So don't put any spaces or characters that would interfere with this or with naming a function in JavaScript. That's because you should define the following functions: <name>_setup(team) and <name>_getActions(gameInfo, botVars). Further down the page, there exist textareas for the userbot, which you can edit to test your code.
<name>_setup(team)
This function is for you to define any variables that you want to persist. team will be either "red" or "blue". This function must return an object. Define variables like so:
var vars = {};
vars['example'] = "example";
return vars;

This vars object will be passed in to the other function:
<name>_getActions(gameInfo, botVars)
botVars is the object returned by <name>_setup(team). gameInfo is an object containing the following variables:
redScore
blueScore
timeLeft

fieldWidth
fieldHeight

sun_x
sun_y
sun_r //sun's radius

gravityStrength //acceleration in pixels/frame^2 at 1 pixel away from the sun's center
engineThrust    //acceleration in pixels/frame^2

speedLimit //maximum speed under engine power
maxSpeed   //maximum speed from gravity boosts

red_x
red_y
red_rot          //rotation in degrees
red_xv           //x velocity
red_yv           //y velocity
red_shape        //one of "full ship", "left wing", "right wing", "nose only"
red_missileStock //the number of missiles red has left
red_inHyperspace //true if red is in hyperspace
red_exploded     //until red explodes, it is still solid and hazardous
red_alive
// likewise for blue //

numMissiles
missiles //this is a list of objects, each with the following variables
  x
  y
  xv
  yv

Your bot has full access to these. I'm pretty sure that you can write to them and not affect the original variables, but don't do it anyway. A note on rotations: ships point in the +y direction, downwards, so anything that you want to align with the ship needs to be offset by 90 degrees. Also, positive rotation is clockwise.
This function must return a list of strings, representing your bot's actions. For example, ["turn right","thrust"]. More details on this are in the Rules section.
Additional Details
You may also make use of the following:
LineIntersection(L1, L2)
L1 and L2 are two-element arrays of two-element arrays. That is, L1 := [[x1,y1],[x2,y2]] and L2 := [[u1,v1],[u2,v2]]. This function computes the intersection of two lines and returns this: [[x,y], [a,b]]. [x,y] are the coordinates of the intersection point and [a,b] is a pair of ratios that express how far along each line the intersection point is. As in, a = 0.25 would mean that the intersection point is a quarter of the way from [x1,y1] to [x2,y2], and likewise for b. If there is no intersection, an empty array is returned.
window["shipShapes"]
var shipShapes = {
    'full ship': [[-8,16],[0,-8],[8,16]],
    'left wing': [[-8,16],[0,-8],[4,4],[0,8],[0,16]],
    'right wing':[[-4,4],[0,-8],[8,16],[0,16],[0,8]],
    'nose only': [[-4,4],[0,-8],[4,4],[0,8]]
};

These are the coordinates of the ships' polygons. To make getting the current coordinates easier, you may also use...
getShipCoords(<color>)
getShipCoords("red") will return the current coordinates of the vertices of Red's ship, and likewise for getShipCoords("blue") and Blue. These coordinates are in a list like so: [[x1,y1],[x2,y2],[x3,y3],...]. Polygons are implicitly closed, so there is a line between the first and last coordinate pairs.
You may not access or alter any other variables or functions in use by the game/website. And definitely don't name your functions the same. I don't foresee that this will be a problem, but if your bot breaks the game code, that's one possibility. There is no logging or catching of exceptions.
Winning

Every pairing of bots shall be played at least 10 times, both ways. (So, at least 20 games total.)
Aim to have the highest win/loss ratios overall. If your bot does super well against one other bot, but loses against the other three, that's not as good as winning against two and losing against two (as a general rule of thumb).
For every bot, the ratios (wins+1)/(losses+1) will be calculated, then the mean and standard deviation of these ratios will be calculated. A higher mean will have priority, and in case means are within 1 unit of each other, the lower variance will have priority.
Scoring will begin either in a week from today or after three days of no new submissions. This is so I don't have to repeat any pairing of bots.

Above all, have fun!

Leaderboard (2016-01-08 05:15):
#   Name                       Mean      StdDev
1.  Helios                     13.625    6.852
2.  EdgeCase                    8.335    8.155
3.  OpponentDodger              8.415    8.186
4.  OrbitBot                    5.110    6.294
5.  SunAvoider                  5.276    6.772
6.  DangitBobby                 3.320    4.423
7.  SprayAndPray                3.118    4.642
8.  Engineer                    3.903    6.315
9.  RighthandedSpasms           1.805    2.477
10. AttackAndComeBack           2.521    2.921
11. PanicAttack                 2.622    3.102
12. FullSpeedAhead              2.058    3.295
13. UhhIDKWhatToCallThisBot     2.555    3.406
14. MissilesPlusScore           0.159    0.228
15. Hyper                       0.236    0.332
16. RandUmmm                    0.988    1.329
17. Kamikaze                    0.781    1.793

Note: This is subject to change as I run more games. Plus, the ordering of ranks 9-13 bothers me, so I may tweak the scoring method to better match one's intuition of how they should be ranked.
(Means and standard deviations were rounded to three decimal digits. Also, Hyper should be HYPER but that messes up the highlighting. :P)

Any scores?....

Does it log caught exceptions?

The angle is measured from the top vertical axis clockwise.

You should specify that calling LineIntersection on non-intersecting segments returns an empty array.

Congrats on making the hot questions list!

@TheNumberOne: No exceptions are caught. I've added that note on rotations.

@LegionMammal978: Good spot. Added.

@BlockCoder1392: Added a note on that at the end. I don't want to re-run battles, so I'll be waiting at least a few days before I start tallying scores.

Someone should make a bot that avoids the other player :P

@BlockCoder1392: That would be pretty easy for me, actually. I wrote a "RammingSpeed" bot last night that tries to hit the other player and avoids the sun. It'd be a simple matter of flipping signs.

I think I did it!

@CrazyPython: I'd dispute the first two considering that I basically copied a game, but the third is exactly what I wanted. Thanks! :D

@El'endiaStarman No kind of game has ever happened on PPCG before. It takes a lot of work to make a perfect clone.

Should there be a chatroom on this?

@CrazyPython: There is.

@Sleafar: WHOOPS. Fixed.

Is it just me ... or is the site not displaying any of the bots?

@TheNumberOne: I hard refreshed the page on my computer and I see them all. Try refreshing.

@El'endiaStarman Ya, that fixed it :)

Still not seeing the other bots. :⊂

I think there should be scores now

@BlockCoder1392: Yeah, I'll do that today/tonight.

HYPER wasn't last with a 25% chance of dying each frame?

@GenericUser: That's an artifact of the scoring system, which shall be reworked. HYPER has a smaller standard deviation than the last two...

@El'endiaStarman is there any possibility to add multiple user bots to the simulation? That way i can trial other submissions before you officially add them to the simulation.

@Moogie: On the website proper, I'd have to add extra functionality for that, and I'm not really inclined to do so. You can, however, easily save the website to your computer and add JS files for your bots. Or just open up multiple tabs and test different user bots in each.

@El'endiaStarman: I am just wondering when the leader board will be updated? I notice that my entry back in Jan has never been officially tested.

@Moogie: I had been planning on adding a leaderboard feature to the website, which would be the last feature I add. I've just been working on other stuff.

Hi, how to check a ship shape is 'nose only' ? Because testing getShipCoords dont work...

@TùxCräftîñg: red_shape or blue_shape. It's in the question body.

@El'endiaStarman about RammingSpeed - could you post that bot as a non-competing bot just-for-fun?

@AgentCrazyPython: I feel like there are already plenty of trivial bots.

@El'endiaStarman Oh. I thought you said it was pretty good.

updated leaderboard?

can you please please add a way to increase delay between frames. it's required for studying behavior.

Helios
This bot is the center of the universe, or at least he thinks he is. The first thing he makes is to correct a grave error and place himself in the center of the coordinate system. Then he rotates anything around himself.
He doesn't like the other (fake) sun, therefore he tries to stay away from it. He also doesn't like other bots, therefore he shoots at them, if he is in a good shooting position.
function Helios_setup(team) {
    var botVars = {};
    botVars.myPrefix = team + "_";
    botVars.enemyPrefix = team == "red" ? "blue_" : "red_";
    return botVars;
}

function Helios_getActions(gameInfo, botVars) {
    var actions = [];
    var halfPi = Math.PI / 2;
    var engageAngle = Math.PI / 8;

    var field = {};
    field.width = gameInfo.fieldWidth;
    field.height = gameInfo.fieldHeight;
    field.halfWidth = field.width / 2;
    field.halfHeight = field.height / 2;
    field.posOffsetX = field.width * 3 / 2 - gameInfo[botVars.myPrefix + "x"];
    field.posOffsetY = field.height * 3 / 2 - gameInfo[botVars.myPrefix + "y"];
    field.posAngle = (450 - gameInfo[botVars.myPrefix + "rot"]) % 360 * Math.PI / 180;
    field.posSin = Math.sin(-field.posAngle);
    field.posCos = Math.cos(-field.posAngle);
    field.movOffsetXV = -gameInfo[botVars.myPrefix + "xv"];
    field.movOffsetYV = gameInfo[botVars.myPrefix + "yv"];
    field.movAngle = Math.atan2(-field.movOffsetYV, -field.movOffsetXV);
    field.movSin = Math.sin(-field.movAngle);
    field.movCos = Math.cos(-field.movAngle);

    function zeroIfUndefined(v) {
        return v === undefined ? 0 : v;
    }

    function sqr(x) {
        return x * x
    }

    function getEntity(source, prefix) {
        var tmpX = (field.posOffsetX + zeroIfUndefined(source[prefix + "x"])) % field.width - field.halfWidth;
        var tmpY = field.halfHeight - (field.posOffsetY + zeroIfUndefined(source[prefix + "y"])) % field.height;
        var tmpXV = zeroIfUndefined(source[prefix + "xv"]);
        var tmpYV = -zeroIfUndefined(source[prefix + "yv"]);
        var e = {};
        e.posX = tmpX * field.posCos - tmpY * field.posSin;
        e.posY = tmpX * field.posSin + tmpY * field.posCos;
        e.posR = Math.sqrt(sqr(e.posX) + sqr(e.posY));
        e.posPhi = Math.atan2(e.posY, e.posX);
        e.posXV = tmpXV * field.posCos - tmpYV * field.posSin;
        e.posYV = tmpXV * field.posSin + tmpYV * field.posCos;
        e.posV = Math.sqrt(sqr(e.posXV) + sqr(e.posYV));
        e.movX = tmpX * field.movCos - tmpY * field.movSin;
        e.movY = tmpX * field.movSin + tmpY * field.movCos;
        e.movR = Math.sqrt(sqr(e.movX) + sqr(e.movY));
        e.movPhi = Math.atan2(e.movY, e.movX);
        e.movXV = (tmpXV + field.movOffsetXV) * field.movCos - (tmpYV + field.movOffsetYV) * field.movSin;
        e.movYV = (tmpXV + field.movOffsetXV) * field.movSin + (tmpYV + field.movOffsetYV) * field.movCos;
        return e;
    }

    function getShip(prefix) {
        var ship = getEntity(gameInfo, prefix);
        ship.missileStock = gameInfo[prefix + "missileStock"];
        ship.inHyperspace = gameInfo[prefix + "inHyperspace"];
        ship.exploded = gameInfo[prefix + "exploded"];
        ship.alive = gameInfo[prefix + "alive"];
        return ship;
    }

    var myShip = getShip(botVars.myPrefix);
    myShip.movAngle = (field.posAngle - field.movAngle + 3 * Math.PI) % (2 * Math.PI) - Math.PI;
    var enemyShip = getShip(botVars.enemyPrefix);
    var sun = getEntity(gameInfo, "sun_");

    enemyShip.intersectionLine = [[enemyShip.movX - enemyShip.movXV * 30, enemyShip.movY - enemyShip.movYV * 30],
            [enemyShip.movX + enemyShip.movXV * 30, enemyShip.movY + enemyShip.movYV * 30]];

    var intersection = LineIntersection([[0, 0], [Math.cos(myShip.movAngle) * 10 * 30, Math.sin(myShip.movAngle) * 10 * 30]],
            enemyShip.intersectionLine);
    if (intersection.length == 2) {
        myShip.intersection = Math.abs(intersection[1][0] / 2 + 0.5 - intersection[1][1]);
    }
    intersection = LineIntersection([[0, 0], [Math.cos(myShip.movAngle - 0.001) * 10 * 30, Math.sin(myShip.movAngle - 0.001) * 10 * 30]],
            enemyShip.intersectionLine);
    if (intersection.length == 2) {
        myShip.intersectionLeft = Math.abs(intersection[1][0] / 2 + 0.5 - intersection[1][1]);
    }
    intersection = LineIntersection([[0, 0], [Math.cos(myShip.movAngle + 0.001) * 10 * 30, Math.sin(myShip.movAngle + 0.001) * 10 * 30]],
            enemyShip.intersectionLine);
    if (intersection.length == 2) {
        myShip.intersectionRight = Math.abs(intersection[1][0] / 2 + 0.5 - intersection[1][1]);
    }

    function danger() {
        var tmp1 = sqr(sun.movXV) + sqr(sun.movYV);
        var tmp2 = tmp1 == 0 ? 0 : Math.max(0, Math.min(1, ((-sun.movX) * sun.movXV + (-sun.movY) * sun.movYV) / tmp1));
        var dis = Math.sqrt(sqr(sun.movX + tmp2 * sun.movXV) + sqr(sun.movY + tmp2 * sun.movYV));
        if (dis < 30) {
            return true;
        }
        var shipLine1 = [[-16, 8], [-16, -8]];
        var shipLine2 = [[-16, 8], [8, 0]];
        var shipLine3 = [[-16, -8], [8, 0]];
        if (gameInfo.missiles !== undefined) {
            for (var i = 0; i < gameInfo.missiles.length; i++) {
                var missile = getEntity(gameInfo.missiles[i], "");
                var missileLine = [[missile.movX + missile.movXV * 0.5, missile.movY + missile.movYV * 0.5],
                        [missile.movX + missile.movXV * 3, missile.movY + missile.movYV * 3]];
                if (LineIntersection(shipLine1, missileLine).length == 2 ||
                        LineIntersection(shipLine2, missileLine).length == 2 ||
                        LineIntersection(shipLine3, missileLine).length == 2) {
                  return true;
                }
            }
        }
        return false;
    }

    function fire() {
        return enemyShip.alive && !enemyShip.inHyperspace && myShip.intersection !== undefined &&
            myShip.intersection < 0.1 + myShip.missileStock / 200;
    }

    function evadeSun() {
        if ((sun.movPhi >= 0 && myShip.movAngle < 0) || (sun.movPhi <= 0 && myShip.movAngle > 0)) {
            actions.push("fire engine");
        }
        if (sun.movPhi > 0) {
            if (Math.abs(myShip.movAngle) < halfPi) {
                actions.push("turn right");
            } else {
                actions.push("turn left");
            }
        } else {
            if (Math.abs(myShip.movAngle) < halfPi) {
                actions.push("turn left");
            } else {
                actions.push("turn right");
            }
        }
    }

    function aim() {
        if (myShip.intersection !== undefined && myShip.intersectionLeft !== undefined && myShip.intersectionLeft < myShip.intersection) {
            actions.push("turn left");
        } else if (myShip.intersection !== undefined && myShip.intersectionRight !== undefined && myShip.intersectionRight < myShip.intersection) {
            actions.push("turn right");
        } else {
            if (enemyShip.posPhi > 0) {
                actions.push("turn left");
            } else {
                actions.push("turn right");
            }
        }
        if (myShip.posV < 2 || (enemyShip.alive && (enemyShip.movXV >= 0 || myShip.missileStock == 0))) {
            actions.push("fire engine");
        }
    }

    function brake() {
        if (myShip.movAngle > 0) {
            actions.push("turn left");
        } else {
            actions.push("turn right");
        }
        if (Math.abs(myShip.movAngle) > Math.PI * 3 / 4) {
            actions.push("fire engine");
        }
    }

    function engage() {
        if (enemyShip.missileStock > 0) {
            if ((enemyShip.posPhi > 0 && enemyShip.posPhi < engageAngle) || enemyShip.posPhi < -engageAngle) {
                actions.push("turn right");
            } else {
                actions.push("turn left");
            }
        } else {
            if (enemyShip.posPhi > 0) {
                actions.push("turn left");
            } else {
                actions.push("turn right");
            }
        }
        actions.push("fire engine");
    }

    if (myShip.alive && !myShip.inHyperspace) {
        if (danger()) {
            actions.push("hyperspace");
        }
        if (fire()) {
            actions.push("fire missile");
        }
        if (enemyShip.exploded || enemyShip.inHyperspace || sun.movR < 150 || (sun.movR < 300 && Math.abs(sun.movPhi) < Math.PI)) {
            evadeSun();
        } else if (enemyShip.posR < 300 || myShip.intersection !== undefined) {
            aim();
        } else if (myShip.posV > 10) {
            brake();
        } else {
            engage();
        }
    }

    return actions;
}

I think this is one of my favorite bots so far. It's surprisingly good!

@El'endiaStarman I made some updates to the bot.

Your update is now live!

This works very well against OrbitBot :)

@TheNumberOne I'm curious how both will perform, when you finally add missiles fired on a second orbit. ;)

I cannot win with this! How did you do that?!

@Soaku I think the main difference between this bot and most of the others is, that this bot aims at his opponent before shooting.

SunAvoider
This one just tries to stay away from the sun. It does so pretty well...until it gets one or both wings destroyed, then it's usually only a matter of time before it falls in.
function SunAvoider_setup(team) {
    var botVars = {};

    botVars["color"] = team;

    return botVars;
}

function SunAvoider_getActions(gameInfo, botVars) {
    var actions = [];

    if (gameInfo[botVars["color"]+"_alive"]) {
        var shipx = gameInfo[botVars["color"]+"_x"];
        var shipy = gameInfo[botVars["color"]+"_y"];
        var sunx = gameInfo["sun_x"];
        var suny = gameInfo["sun_y"];
        var dx = shipx - sunx;
        var dy = shipy - suny;
        var dis = Math.sqrt(dx*dx+dy*dy);
        var fireEngineChance = (dis-100)/(gameInfo["fieldHeight"]/2);

        if (Math.random() > fireEngineChance){ actions.push("fire engine") }

        var ang1 = gameInfo[botVars["color"]+"_rot"]+90;
        var ang2 = Math.degrees( Math.atan2(dy, dx) );
        var angDiff = ang2 - ang1;
        if (angDiff < -180) { //http://stackoverflow.com/a/7869457/1473772
            angDiff += 360;
        } else if (angDiff > 180) {
            angDiff -= 360;
        }

        if (angDiff >= 0) {
            actions.push("turn left");
        } else if (angDiff < 0) {
            actions.push("turn right");
        }
    }

    return actions;
}

EdgeCase
Flies at full speed away from the sun towards the edge of the map! When it finds itself pointed towards the sun it will start shooting while turning itself away to get back to the edge. It also enters hyperspace when it's about to hit the sun.
function EdgeCase_setup(team) {
  var botVars = {};
  botVars["color"] = team;
  return botVars;
}

function EdgeCase_getActions(gameInfo, botVars) {
  var actions = [];

  // Get our ship's position
  var rotation, x, y, opponentAlive;
  if(botVars.color == "red") {
    rotation = gameInfo.red_rot;
    x = gameInfo.red_x;
    y = gameInfo.red_y;
    opponentAlive = gameInfo.blue_alive;
  }
  else if(botVars.color == "blue") {
    rotation = gameInfo.blue_rot;
    x = gameInfo.blue_x;
    y = gameInfo.blue_y;
    opponentAlive = gameInfo.red_alive;
  }

  // Calculate our rotation compared to the sun in degrees
  var sunX = gameInfo.sun_x,
      sunY = gameInfo.sun_y,
      angle = Math.atan2(sunY - y, sunX - x) * 180 / Math.PI,
      rotationToSun = (rotation - angle + 360) % 360;

  // Check if we need to hyperspace to avoid the sun
  var rX = x - sunX,
      rY = y - sunY,
      distanceFromSun = Math.sqrt(rX * rX + rY * rY) - gameInfo.sun_r;
  if(distanceFromSun < 30) actions.push("hyperspace");
  else {

    // Turn away from the sun
    if(rotationToSun > 90 && rotationToSun < 270) {
      actions.push("turn right");
    }
    else actions.push("turn left");

    // Fire engines if we're pointing away from the sun
    if(rotationToSun > 180) {
      actions.push("fire engine");
    }

    // If we shoot while our opponent's dead we can only kill ourself
    else if(opponentAlive) actions.push("fire missile");
  }

  return actions;
}

This bot is now live! Also, this one was surprisingly easy to survive against. Probably has to do with how it doesn't spam missiles everywhere like some of the others. :P

OrbitBot
Currently has no targeting or collision avoidance. It tries to orbit the sun.
Edit: Now goes into hyperspace when impact is imminent.
function OrbitBot_setup(team) {
  var botVars = {};

  botVars.color = team;
  return botVars;
}

function OrbitBot_getActions(gameInfo, botVars) {
  var actions = [];

  function getVar(name) {
    return gameInfo[botVars.color + "_" + name];
  }

  function getEnemyVar(name) {
    var eColor;
    if (botVars.color == 'blue') {
        eColor = 'red';
    } else {
        eColor = 'blue';
    }
    return gameInfo[eColor + "_" + name];
  }

  function distance(x1, y1, x2, y2) {
    return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  }

  function toroidDistance(x1, y1, x2, y2) {
    dx = Math.abs(x1 - x2);
        while (dx > gameInfo.fieldWidth) {
        dx -= gameInfo.fieldWidth;
    }
    dx = Math.min(dx, gameInfo.fieldWidth - dx);
    dy = Math.abs(y1 - y2);
        while (dx > gameInfo.fieldHeight) {
        dx -= gameInfo.fieldHeight;
    }
    dy = Math.min(dy, gameInfo.fieldHeight - dy);
    return Math.sqrt(dx*dx+dy*dy);
  }

  function angleDistance(theta1, theta2) {
    var d = theta1 - theta2;
    while (d < 0 || d > Math.PI) {
      if (d < 0) {
        d += Math.PI * 2;
      }
      if (d > Math.PI * 2) {
        d -= Math.PI * 2;
      } else if (d > Math.PI) {
        d = Math.PI * 2 - d;
      }
    }
    return d;
  }

  function toRad(degrees) {
    return degrees / 180 * Math.PI;
  }

  function cap(x, y, limit) {
    var r = x*x+y*y;
    if (r < limit * limit) {
        r = Math.sqrt(r);
        x = x * r / limit;
      y = y * r / limit;
    }
    return [x,y];
  }

  var shape = getVar('shape');

  if (shape != 'nose only') {
    var broken = shape != 'full ship';
    var sunX = gameInfo.sun_x,
      sunY = gameInfo.sun_y,
      sunG = gameInfo.gravityStrength;

    function desirability(x, y, vx, vy) {     //Borrowed from a useless bot.
      var lowest = distance(x, y, sunX, sunY) - 5;
      var missiles = gameInfo.missiles;
      for (var i = 0; i < missiles.length; i++) {
        var mx = missiles[i].x + missiles[i].xv / 2;
        var my = missiles[i].y + missiles[i].yv / 2;
        lowest = Math.min(lowest, toroidDistance(x, y, mx, my) - distance(0, 0, missiles[i].xv, missiles[i].yv));
      }
      return lowest - 16;
    }

    var x = getVar("x"),
      y = getVar("y"),
      vx = getVar("xv"),
      vy = getVar("yv");

    function desirabilityByAcceleration(ax, ay) {//Borrowed from a useless bot.
        var x1 = x,
            y1 = y,
          vx1 = vx,
          vy1 = vy;
      var speed = distance(0,0,vx1,vy1);
      var limit = Math.max(gameInfo.speedLimit, speed);

      vx1 += ax;
      vy1 += ay;
      var temp = cap(vx1, vy1, limit);
      vx1 = temp[0];
      vy1 = temp[1];

      var dx = x1 - sunX;
      var dy = y1 - sunY;
      var dis = Math.sqrt(dx*dx+dy*dy);
      if (dis > 5){
        var force = sunG / (dis * dis);
      } else {
        var force = sunG /5;
      }
      vx1 -= force*dx/dis;
      vy1 -= force*dy/dis;

      var temp = cap(vx1, vy1, 40);
      vx1 = temp[0];
      vy1 = temp[1];

      x1 += vx1;
      y1 += vy1;

      return desirability(x1, y1, vx1, vy1);
    }

    var r = distance(sunX, sunY, x, y);
    var theta = Math.atan((y - sunY) / (x - sunX));

    var sunA = sunG/r/r,
            sunAx = -Math.cos(theta) * sunA,
        sunAy = -Math.sin(theta) * sunA;

    var dv = Math.sqrt(sunG / r);
    var dvx = -dv * Math.sin(theta);
    var dvy = dv * Math.cos(theta);
    if (distance(-dvx, -dvy, vx, vy) < distance(dvx, dvy, vx, vy)) {
      dvx = -dvx;
      dvy = -dvy;
    }

    var dax = dvx - vx;
    var day = dvy - vy;

    var dAngle = Math.atan(day / dax);
    if (dax < 0) {
        dAngle += Math.PI;
    }
    var cAngle = toRad(getVar('rot') - 90);
    var dLeft = angleDistance(cAngle - toRad(broken ? 2.5 : 5), dAngle);
    var dRight = angleDistance(cAngle + toRad(broken ? 2.5 : 5), dAngle);
    var dNeither = angleDistance(cAngle, dAngle);
    if (dLeft < dRight && dLeft < dNeither) {
      actions.push('turn left');
    } else if (dRight < dLeft && dRight < dNeither) {
      actions.push('turn right');
    }

    var cax = Math.cos(cAngle) * (broken ? .15 : .3);
    var cay = Math.sin(cAngle) * (broken ? .15 : .3);

    var ax = 0;
    var ay = 0;

    if (distance(cax, cay, dax, day) < distance(0, 0, dax, day)) {
      actions.push('fire engine');
      ax = cax;
      ay = cay;
    }

    if (desirabilityByAcceleration(ax, ay) <= 16) {
        actions.push('hyperspace');
    }

  }

  return actions;
}

Your bot has been added.

Your update is now live!

RighthandedSpasms
The name is pretty descriptive. Chooses turn right with 0.5 probability, fire engine with 0.5 probability, and fire missile with 0.8 probability. Surprisingly difficult, mainly because it's really unpredictable.
function RighthandedSpasms_setup(team) {
    var botVars = {};

    botVars["color"] = team;

    return botVars;
}

function RighthandedSpasms_getActions(gameInfo, botVars) {
    var actions = [];

    if (gameInfo[botVars["color"]+"_alive"]) {
        if (Math.random() > 0.5) { actions.push("turn right") }
        if (Math.random() > 0.5) { actions.push("fire engine") }
        if (Math.random() > 0.8) { actions.push("fire missile") }
    }

    return actions;
}

RandUmmm
This challenge needed a random bot. Bonus points for golfiness?
function RandUmmm_setup(t){
    function P(n,t,r,o,e,f,g){for(o=[e=1<<(f=n.length)];e;)for(t=e.toString(2),r=g=t.length,o[--e]=[];r;)~-t[--r]||o[e].push(n[r+f-g]);return o}var q=P(["fire missile","turn right","fire engine","turn left"]);q.pop();
    return {color:t,m:function(){return q[Math.random()*q.length|0]}};
}

function RandUmmm_getActions(g,b){
    return b.m();
}

Cool! (By the way, my bot won 13-7. Not by a lot, considering I lost 9-1 once, but that's a lot of points in total. 20 points in 90 seconds!)

@BlockCoder1392 it is a random bot ;)

Engineer
Likes to use hyperspace when in danger. To see it's true power, open up your browser's console and type overideHyperspace = 0;. If you forget the semicolon, you'll get ASI for Christmas.
function Engineer_setup(t){
    return{c:t,C:"red0blue".split(0)[+(t=="red")]};
}

function Engineer_getActions(gameInfo,botVars){
    var actions = [];

    function d(x1,y1,x2,y2){return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))}
    function hS(g){return d(g.sun_x,g.sun_y,g[botVars.c+"_x"],g[botVars.c+"_y"])<50}
    function enemyDist(g){return d(g[botVars.c+"_x"],g[botVars.c+"_y"],g[botVars.C+"_x"],g[botVars.C+"_y"]);}

    function hSm(g){
        // get closest missile
        var r = (g.missiles||[{x:10000,y:10000}]).reduce(function(p,c){return Math.min(d(c.x,c.y,g[botVars.c+"_x"],g[botVars.c+"_y"]),p)},Infinity);
        return r<18;
    }
    function dF(g){
        var a = Math.degrees(Math.atan2(g[botVars.C+"_y"]-g[botVars.c+"_y"],g[botVars.C+"_x"]-g[botVars.c+"_x"]));
        var tP = (g[botVars.c+"_rot"]+360-a)%360;
        return [a,tP];
    }
    function lOr(g){
        var tP = dF(g)[1];
        return 90<tP&&tP<270?"turn left":"turn right";
    }
    function thrust(g){
        return Math.abs(dF(g)-g[botVars.c+"_rot"]);
    }

    // are we too close to the sun or a missile?
    if(hS(gameInfo)||hSm(gameInfo))actions.push("hyperspace");

    // should we fire?
    if(enemyDist(gameInfo)<200)actions.push("fire missile");

    // direction function
    actions.push(lOr(gameInfo,botVars));

    if(Math.random()<.7)actions.push("fire engine");
    return actions;
}

Kamikaze
Not very competitive but I thought it would be fun! Just flies straight towards it's opponent while shooting.
function Kamikaze_setup(team) {
  var botVars = {};
  botVars["color"] = team;
  return botVars;
}

function Kamikaze_getActions(gameInfo, botVars) {
  var actions = [];

  // Get our ship's position
  var us, them, red = {
        rotation: gameInfo.red_rot,
        x: gameInfo.red_x,
        y: gameInfo.red_y,
        alive: gameInfo.blue_alive
      },
      blue = {
        rotation: gameInfo.blue_rot,
        x: gameInfo.blue_x,
        y: gameInfo.blue_y,
        alive: gameInfo.blue_alive
      };
  if(botVars.color == "red") {
    us = red;
    them = blue;
  }
  else if(botVars.color == "blue") {
    us = blue;
    them = red;
  }

  // Turn towards our opponent's position
  var angle = Math.degrees(Math.atan2(them.y - us.y, them.x- us.x)),
      rotationToOpponent = (us.rotation - angle + 360) % 360;
  if(rotationToOpponent > 90 && rotationToOpponent < 270) {
    actions.push("turn left");
  }
  else actions.push("turn right");

  actions.push("fire missile", "fire engine");

  return actions;
}

Your bot has been added!

Terrible against OpponentDodger... Tied with PanicAttack...

SprayAndPray
function SprayAndPray_setup(team) {
    var botVars = {};
    botVars["color"] = team;
    return botVars;
}

function SprayAndPray_getActions(gameInfo, botVars) {
    var actions = [];

    if (gameInfo[botVars["color"]+"_alive"]) {
        actions.push("turn left");
        if (Math.random() > 0.5) { actions.push("fire engine")};
       actions.push("fire missile");
    }

    return actions;
}

Fires wildly in every direction.  It's not very effective!

This bot is now live!

OpponentDodger
GET AWAY FROM ME OPPONENT!!!
function OpponentDodger_setup(t){b={};b["c"]=t;b['o']=(t=="red")?"blue":"red";return b;}function OpponentDodger_getActions(g,b){a=[];o=b["c"];j={r:g[o+"_rot"],x:g[o+"_x"],y:g[o+"_y"]};o=b["o"];p={r:g[o+"_rot"],x:g[o+"_x"],y:g[o+"_y"]};l=Math.degrees(Math.atan2(p.y-j.y,p.x-j.x)),x=(j.r-l+360)%360;if(x > 90 && x < 270)a.push("turn right");else a.push("turn left");a.push("fire engine");return a;}

Thanks to user81655 for some code!

This bot is now live!

UhhIDKWhatToCallThisBot
Just random stuff.

function UhhIDKWhatToCallThisBot_setup(team) {
var botVars = {};
 botVars['t'] = 0;
botVars["color"] = team;
     return botVars;

}

function UhhIDKWhatToCallThisBot_getActions(gameInfo, botVars) {
    var actions = [];
    //when i need it: "turn left",
    //Use missiles sparingly!
    var WCID = [
    "fire engine",
     "turn right",
    "fire engine",
    "fire missile",
    "turn right",
    "fire engine"]

    if (gameInfo[botVars["color"]+"_alive"]) {
        botVars['t']++;
        actions.push(WCID[botVars[t]%(WCID.length)]);
    }
     return actions;
}

what's up with the cryptic golfiness?

Spy
The story
The prototype to this bot was a bot that had two modes: crazy mode and normal mode. When it was in crazy mode, it stayed there for a constant number of ticks. There was a contant probability of entering crazy mode. It also hyperspaced when it was close to the sun. In crazy mode, it aimed to the other bot and fired constantly. In normal mode, it flew away from the other bot, not firing.
I tweaked that prototype so that it would be in crazy mode if and only if the enemy was close enough. Then I had a crazy idea: what if it only stayed in crazy mode? After some experimentation (I added making the bot fire randomly when it was in normal mode) I found me new bot beat every bot but Helios. This is my code at the end of this process, but before cleaning up.
I wrote my entire bot in the KotH textarea or the JS beautifier. (I did briefly use the Atom editor when cleaning up - but for like two lines of code)
The bot
This bot contains a lot of code borrowed from other bots. It flips the code from Kamikaze to run away from the other bot instead of running to the other bot and it takes code from EdgeCase for hyperspacing when it's close to the sun.
It's arch nemesis is Helios. It being the odd one out and long chats with a martini.
It runs away from the other bot with a 70% chance of firing a missile and hyperspaces when it's close to the sun. As simple as that. Yep.
Edit: I tested my bot with the new code and it fails for every other bot. I'm working on fixing it. I just confirmed this is only for my new bot.
The code
function Spy_setup(team) {
  // Typical setup. Nothing to see here. ;)
  var botVars = {};
  botVars["color"] = team;
  return botVars;
}

function Spy_getActions(gameInfo, botVars) {
    var actions = [];
    var us, them, red = {
            rotation: gameInfo.red_rot,
            x: gameInfo.red_x,
            y: gameInfo.red_y,
            alive: gameInfo.blue_alive
        },
        blue = {
            rotation: gameInfo.blue_rot,
            x: gameInfo.blue_x,
            y: gameInfo.blue_y,
            alive: gameInfo.blue_alive
        };
    if (botVars.color == "red") {
        us = red;
        them = blue;
    } else if (botVars.color == "blue") {
        us = blue;
        them = red;
    }

    function distance(x1, y1, x2, y2) {
        return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    }

    // Get our ship's position
    var rotation, x, y, opponentAlive;
    if (botVars.color == "red") {
        rotation = gameInfo.red_rot;
        x = gameInfo.red_x;
        y = gameInfo.red_y;
        opponentAlive = gameInfo.blue_alive;
    } else if (botVars.color == "blue") {
        rotation = gameInfo.blue_rot;
        x = gameInfo.blue_x;
        y = gameInfo.blue_y;
        opponentAlive = gameInfo.red_alive;
    }

    // Calculate our rotation compared to the sun in degrees
    var sunX = gameInfo.sun_x,
        sunY = gameInfo.sun_y,
        angle = Math.atan2(sunY - y, sunX - x) * 180 / Math.PI,
        rotationToSun = (rotation - angle + 360) % 360;

    // Check if we need to hyperspace to avoid the sun
    var rX = x - sunX,
        rY = y - sunY,
        distanceFromSun = Math.sqrt(rX * rX + rY * rY) - gameInfo.sun_r;
    if (distanceFromSun < 30) {
        actions.push("hyperspace");
        console.log("Command Module is Hyperspacing.")
    }
    if (gameInfo[botVars["color"] + "_alive"]) {
        var angle = Math.degrees(Math.atan2(them.y - us.y, them.x - us.x)),
            rotationToOpponent = (us.rotation - angle + 360) % 360;
        if (rotationToOpponent > 90 && rotationToOpponent < 270) {
            actions.push("turn right");
        } else {
            actions.push("turn left");
        };
        actions.push("fire engine");
        if (Math.random() > 0.3) {
            actions.push("fire missile")
        }

    }
    return actions;
}

The misc
Note: I might've broke something when cleaning up the code because I didn't test the bot after cleaning up the code.
It's also much much much better than all my other bots - it actually beat every other bot except for Helios (edit) , SetCourseFor30Degrees, and OrbitBot! It ties with SunAvoider.
Side note: I'm horrible at javascript, don't know why.

@El'endiaStarman please put putting the bot live on pause; I need to fix my bot - the cleaned up version is so much worse than the unclean version.

Alright, let me know when it's fixed.

@El'endiaStarman I did a thing and then it worked again. Debugging, you know! (not done yet)

@El'endiaStarman ...and it's done!

This bot is now live!

PanicAttack
Has a 50% chance of firing, and an 80% chance of turning left; but if it doesn't turn left, it'll turn right. After it runs out of missiles, time will eventually make it stop due to the sun.
EDIT: Added some logic to not fire when the enemy is alive because it could get killed by its own missiles.
function PanicAttack_setup(team) {
    var botVars = {};
    botVars["color"] = team;
    return botVars;
}

function PanicAttack_getActions(gameInfo, botVars) {
    var actions = [];
    actions.push("fire engine");
    if(botVars.color == "red") {
        var opponentAlive = gameInfo.blue_alive;
    }
    else if(botVars.color == "blue") {
        var opponentAlive = gameInfo.red_alive;
    }

    if ((Math.random()>0.5)&&opponentAlive) {
        actions.push("fire missile");
    }

    if (Math.random()>0.2) {
        actions.push("turn left");
    } else {
        actions.push("turn right");
    }

    return actions;
}

This bot is now live!

@El'endiaStarman Please update it again

Your update is now live!

AttackAndComeBack
Instead of swirling, it comes in at the top and exits at the bottom (returning at the top), firing very quickly. Generally avoids the sun.
function AttackAndComeBack_setup(team) {
    var botVars = {};
    botVars["color"] = team;
    return botVars;
}

function AttackAndComeBack_getActions(gameInfo, botVars) {
    var actions = [];
    actions.push("fire missile");
    if (Math.random()>0.4){actions.push("turn right");}
    else {actions.push("turn left");}
    actions.push("fire engine");
    return actions;
}

This bot is now live!

FullSpeedAhead
Always fires both the engines and the missiles without turning ever. Sometimes lasts surprisingly long before hitting the sun.
function FullSpeedAhead_setup(team){
    return {color: team};
}

function FullSpeedAhead_getActions(gameInfo, botVars){
    var actions = [];

    if (gameInfo[botVars["color"]+"_alive"]) {
        actions.push("fire engine");
        actions.push("fire missile");
    }
    return actions;
}

Not as bad as I thought...

This bot is now live!

DangitBobby
Bobby Hill doesn't care what others think about him- he's quite content to swing lazily around the field and patiently wait for his opponent to run out of steam before striking like a "husky" cobra.
function DangitBobby_setup(team) {
    var botVars = {};
    botVars["color"] = team;
    if (team == 'red'){
        botVars['them'] = "blue";
    }
    else{
        botVars['them'] = 'red';
    }
    return botVars;
}

function DangitBobby_getActions(gameInfo, botVars) {
    var actions = [];
    if (gameInfo[botVars["color"]+"_alive"]) {
        actions.push('turn right');
        actions.push('fire engine');
        if (gameInfo[botVars['them']+'_missileStock'] == 0){
                actions.push('fire missile');
        }

    }
}

"THAT'S MY PURSE! I DON'T KNOW YOU!"

This bot is now live!

Sniper
I've been playing with prediction for a bit to create a sniper bot that snipes his enemies. My javascript is too large to fit in an answer so here is a link,
bot_Sniper.

Finally got around to testing this bot, and unfortunately, it really slows down the game. It's quite choppy, so you need to make your code faster somehow.

Next time, you should post it in a service like GitHub Gists that's designed for code.

Try optimizing your code; I bet it's a really good bot considering how long it is. You can try inling some variables or functions.

You also have some duplicate code - I think you would have alot to gain from posting your bot to code review, on stack exchange.

You could also define the functions you put in Actions() in the outside scope, so the interpreter doesn't have to reparse it every single time you run Actions(). You should also try profiling your code to speed it up.

@El'endiaStarman can you turn it into code pasteable into the userbot fields? I want to see how it works.

SmartArrow
Like Arrow, but smart
function SmartArrow_setup(team) {
    var botVars = {};
    botVars['mpref'] = team + '_';
    botVars['epref'] = team == 'red' ? 'blue_' : 'red_';
    botVars['ecolor'] = team == 'red' ? 'blue' : 'red';
    return botVars;
}

function SmartArrow_getActions(gameInfo, botVars) {
    var actions = [];
    var x = gameInfo[botVars['mpref'] + 'x'],
        y = gameInfo[botVars['mpref'] + 'y'],
        rot = gameInfo[botVars['mpref'] + 'rot']; // SmartArrow position and rotation
    var ex = gameInfo[botVars['epref'] + 'x'],
        ey = gameInfo[botVars['epref'] + 'y']; // Enemy position
    var sunx = gameInfo.sun_x,
        suny = gameInfo.sun_y; // Sun position
    var Dsunx = Math.abs(x - sunx),
        Dsuny = Math.abs(y - suny); // Sun position delta
    var dex = Math.abs(x - ex),
        dey = Math.abs(y - ey); // Enemy position delta
    var sangle = Math.degrees(Math.atan2(suny - y, sunx - x)),
        snrot = (rot - sangle + 360) % 360;
    if (Dsunx < 40 && Dsuny < 40) // If SmartArrow is too close from sun, hyperspace !
        return ['hyperspace'];
    var missiles = gameInfo.missiles;
    for (var i = 0; i < missiles.length; i++) { // Avoid all these silly missiles
        var dx = Math.abs(x - missiles[i].x),
            dy = Math.abs(y - missiles[i].y);
        if (dx < 10 && dy < 10)
            return ['hyperspace'];
    }
    if (gameInfo[botVars['epref'] + 'alive']) { // If his enemy is alive, SmartArrow try to kill him (logic)
        var angle = Math.degrees(Math.atan2(ey - y, ex - x)),
            nrot = (rot - angle + 360) % 360;
        if (nrot > 90 && nrot < 270)
            actions.push('turn left');
        else
            actions.push('turn right');
        if (nrot > 80 && nrot < 100
         && Math.random() > 0.5) actions.push('fire missile'); // If SmartArrow is in a good spot, shot this silly oponnent
        if (Math.random() > 0.5) actions.push('fire engine');
    }
    else { // Simply (try to) act like SunAvoider if his enemy is dead
        if (snrot > 90 && snrot < 270)
            actions.push('turn right');
        else
            actions.push('turn left');
        if (Dsunx < 300 && Dsuny < 300)
            actions.push('fire engine');
        if (dex < 40 && dey < 40)
            actions.push('hyperspace'); // Dying on the corpse of his opponent is dumb.
    }
    return actions;
}

This bot is now live!

Kamikaze-
Also not designed to be competitive. Just for fun. It hyperspaces when close to the sun and chases the player without firing bullets. It's fun to watch this bot chase an unarmed version of Spy, but you can't have more than one userbot, unfortunately.
El'endia: ever considered adding more than one userbot ;)
function KamikazePlus_setup(team) {
  // Typical setup. Nothing to see here. ;)
  var botVars = {};
  botVars["color"] = team;
  return botVars;
}

function KamikazePlus_getActions(gameInfo, botVars) {
    var actions = [];
    var us, them, red = {
            rotation: gameInfo.red_rot,
            x: gameInfo.red_x,
            y: gameInfo.red_y,
            alive: gameInfo.blue_alive
        },
        blue = {
            rotation: gameInfo.blue_rot,
            x: gameInfo.blue_x,
            y: gameInfo.blue_y,
            alive: gameInfo.blue_alive
        };
    if (botVars.color == "red") {
        us = red;
        them = blue;
    } else if (botVars.color == "blue") {
        us = blue;
        them = red;
    }

    function distance(x1, y1, x2, y2) {
        return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    }

    // Get our ship's position
    var rotation, x, y, opponentAlive;
    if (botVars.color == "red") {
        rotation = gameInfo.red_rot;
        x = gameInfo.red_x;
        y = gameInfo.red_y;
        opponentAlive = gameInfo.blue_alive;
    } else if (botVars.color == "blue") {
        rotation = gameInfo.blue_rot;
        x = gameInfo.blue_x;
        y = gameInfo.blue_y;
        opponentAlive = gameInfo.red_alive;
    }

    // Calculate our rotation compared to the sun in degrees
    var sunX = gameInfo.sun_x,
        sunY = gameInfo.sun_y,
        angle = Math.atan2(sunY - y, sunX - x) * 180 / Math.PI,
        rotationToSun = (rotation - angle + 360) % 360;

    // Check if we need to hyperspace to avoid the sun
    var rX = x - sunX,
        rY = y - sunY,
        distanceFromSun = Math.sqrt(rX * rX + rY * rY) - gameInfo.sun_r;
    if (distanceFromSun < 30) {
        actions.push("hyperspace");
        console.log("Command Module is Hyperspacing.")
    }
    if (gameInfo[botVars["color"] + "_alive"]) {
        var angle = Math.degrees(Math.atan2(them.y - us.y, them.x - us.x)),
            rotationToOpponent = (us.rotation - angle + 360) % 360;
        if (rotationToOpponent > 90 && rotationToOpponent < 270) {
            actions.push("turn left");
        } else {
            actions.push("turn right");
        };
        actions.push("fire engine");
    }
    return actions;
}

Just took Kamikaze+'s code and got rid of the missile firing part.

I will probably not add this bot as we already had one other Kamikaze bot, and I'd rather not have three kamikaze bots. Besides, this one is more trivial than the other two.

@El'endiaStarman then I'm requesting multiple userbots - the second one's code field can be a default hidden expandable

MissilesPlusScore
Some strange idea I came up with that takes that the absolute value of difference of the scores and uses a list of moves in a random based of the game way. It works well against bots with a strategy but fails against storms of missiles. Also my first king-of-the-hill.
function MissilesPlusScore__setup(team) {
var botVars = {};
botVars["color"] = team;
return botVars;
}
function MissilesPlusScore_getActions(gameInfo, botVars) {
var actions = [];
var moves=["fire missile","hyperspace","turn right","turn left","fire engine","fire missile","turn right","hyperspace","turn left","fire missile","hyperspace","turn right","turn left","hyperspace","fire engine","fire missile","turn right","turn left","hyperspace","fire missile","turn right","turn left","fire engine","hyperspace","fire missile","turn right","turn left","hyperspace"];
if(gameInfo[botVars["color"]+"_alive"]){
var num=gameInfo["redScore"]-gameInfo["blueScore"];
if(num<0){num=num*-1;}
if(num===0){actions.push(moves[Math.round(Math.random()*4)]);}
else{
actions.push(moves[num+gameInfo["numMissiles"]]);
}
}
    return actions;
}

HYPER
HYPERSPACE IS COOL!!!!!!!!!!!!!!!!
function HYPER_setup(team){var botVars={};botVars["color"]=team;return botVars}function HYPER_getActions(gameInfo,botVars){var actions=[];if(gameInfo[botVars["color"]+"_alive"]){actions.push(["fire engine","fire missile","hyperspace"][Math.round(Math.random()*2)])};return actions}

CoordinateInfluence
Based off the Coordinates, surprisingly effective:
function CoordinateInfluence_setup(team) {
var botVars = {};
botVars["color"] = team;
return botVars;
}
function CoordinateInfluence_getActions(gameInfo, botVars) {
var actions = [];
if (gameInfo[botVars["color"]+"_alive"]) {
if(gameInfo["blue_x"]>gameInfo["red_x"]){
if(gameInfo["blue_y"]<gameInfo["red_y"]){actions.push("turn right");}
else{actions.push("fire engine");}
}
else if(gameInfo["blue_y"]<gameInfo["red_y"]){
if(gameInfo["blue_x"]>gameInfo["red_x"]){actions.push("turn left");}
else{actions.push("fire missile");}
}
else{actions.push("hyperspace");}
}
return actions;
}

Both of these bots are live.

You should post multiple answers instead.

If you ever add another bot, please ping me so I know you did. Your third bot is now live.

SetCourseFor30Degrees
No idea why the captain is so insistent on setting the ship on a course of 30 degrees, but hey, as a lowly ensign, who are you to question?
At least you have been given permission to avoid the sun! And you are allowed to fire the missiles... just not allowed to aim them...
function SetCourseFor30Degrees_setup(team)
{
  var botVars = {};
  botVars["color"] = team;
  return botVars;
}

function SetCourseFor30Degrees_getActions(gameInfo, botVars)
{
var actions = [];
var ang1 = gameInfo[botVars["color"]+"_rot"]+0;
var fireChance=0.95;
// sun avoidance
   var x = gameInfo[botVars["color"]+"_x"];
   var y = gameInfo[botVars["color"]+"_y"];
   var sunX = gameInfo["sun_x"]+0;
   var sunY = gameInfo["sun_y"]+0;
  var dx = sunX- x;
   var dy = sunY - y;
var shortRangeAvoidanceDistance = (dx * dx + dy * dy ) ;

 x = gameInfo[botVars["color"]+"_x"]+gameInfo[botVars["color"]+"_xv"]*10;
 y = gameInfo[botVars["color"]+"_y"]+gameInfo[botVars["color"]+"_yv"]*10;
 dx = sunX- x;
 dy = sunY - y;

var longRangeAvoidanceDistance = (dx * dx + dy * dy ) ;

var vel = Math.sqrt(gameInfo[botVars["color"]+"_xv"]*gameInfo[botVars["color"]+"_xv"]+
gameInfo[botVars["color"]+"_yv"]*gameInfo[botVars["color"]+"_yv"]);

var close=vel*1.5;

if (shortRangeAvoidanceDistance <= close* close)
{
  actions.push("hyperspace");
}
else
{
   if (longRangeAvoidanceDistance <= 200*200)
   {

     x = x+Math.cos((ang1-5)*Math.PI/180)*vel ;
     y = y+Math.sin((ang1-5)*Math.PI/180)*vel ;
     dx = sunX- x;
     dy = sunY - y;
     if (( dx * dx + dy * dy ) > longRangeAvoidanceDistance  )
     {
       actions.push("turn right")
     }
     else
     {
        actions.push("turn left")
     }
  }
  else
  {
    var course = botVars["color"]=="red"?30:-30;
    if (ang1>course ) {actions.push("turn left")}
    if (ang1<course ) {actions.push("turn right")}
  }
  if (Math.random() > fireChance){ actions.push("fire missile") }
  actions.push("fire engine")
}
return actions;
}

This bot is now live!

Arrow
Simply chase his enemy, hyperspace when he is in danger and idle when his enemy is dead.
function Arrow_setup(team) {
    var botVars = {};
    botVars['mpref'] = team + '_';
    botVars['epref'] = team == 'red' ? 'blue_' : 'red_';
    return botVars;
}

function Arrow_getActions(gameInfo, botVars) {
    var actions = [];
    var x = gameInfo[botVars['mpref'] + 'x'],
        y = gameInfo[botVars['mpref'] + 'y'],
        rot = gameInfo[botVars['mpref'] + 'rot']; // My position and rotation
    var ex = gameInfo[botVars['epref'] + 'x'],
        ey = gameInfo[botVars['epref'] + 'y']; // Enemy position
    var Dsunx = Math.abs(x - gameInfo.sun_x);
    var Dsuny = Math.abs(y - gameInfo.sun_y);
    if (Dsunx < 30 && Dsuny < 30) // If Arrow is too close from sun, hyperspace !
        return ['hyperspace'];
    var missiles = gameInfo.missiles;
    for (var i = 0; i < missiles.length; i++) {
        var dx = Math.abs(x - missiles[i].x);
        var dy = Math.abs(y - missiles[i].y);
        if (dx < 10 && dy < 10)
            return ['hyperspace'];
    }
    if (gameInfo[botVars['epref'] + 'alive']) {
        var angle = Math.degrees(Math.atan2(ey - y, ex - x)),
            nrot = (rot - angle + 360) % 360;
        if (nrot > 90 && nrot < 270)
            actions.push('turn left');
        else
            actions.push('turn right');
        if (Math.random() > 0.5) actions.push('fire missile');
    }
    if (Math.random() > 0.5) actions.push('fire engine');
    return actions;
}

This bot is now live!

@El'endiaStarman I have updated the bot

The update is now live! Not much of one though. :P

Kamikaze+
Not designed to be competitive. Just for fun. Technically, it does the opposite of Spy: chase the player, hyperspace when close to the sun, fire missile 70% of the time. I sorta just want to see KamikazePlus chasing Spy and Spy running away like a madman.
function KamikazePlus_setup(team) {
  // Typical setup. Nothing to see here. ;)
  var botVars = {};
  botVars["color"] = team;
  return botVars;
}

function KamikazePlus_getActions(gameInfo, botVars) {
    var actions = [];
    var us, them, red = {
            rotation: gameInfo.red_rot,
            x: gameInfo.red_x,
            y: gameInfo.red_y,
            alive: gameInfo.blue_alive
        },
        blue = {
            rotation: gameInfo.blue_rot,
            x: gameInfo.blue_x,
            y: gameInfo.blue_y,
            alive: gameInfo.blue_alive
        };
    if (botVars.color == "red") {
        us = red;
        them = blue;
    } else if (botVars.color == "blue") {
        us = blue;
        them = red;
    }

    function distance(x1, y1, x2, y2) {
        return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    }

    // Get our ship's position
    var rotation, x, y, opponentAlive;
    if (botVars.color == "red") {
        rotation = gameInfo.red_rot;
        x = gameInfo.red_x;
        y = gameInfo.red_y;
        opponentAlive = gameInfo.blue_alive;
    } else if (botVars.color == "blue") {
        rotation = gameInfo.blue_rot;
        x = gameInfo.blue_x;
        y = gameInfo.blue_y;
        opponentAlive = gameInfo.red_alive;
    }

    // Calculate our rotation compared to the sun in degrees
    var sunX = gameInfo.sun_x,
        sunY = gameInfo.sun_y,
        angle = Math.atan2(sunY - y, sunX - x) * 180 / Math.PI,
        rotationToSun = (rotation - angle + 360) % 360;

    // Check if we need to hyperspace to avoid the sun
    var rX = x - sunX,
        rY = y - sunY,
        distanceFromSun = Math.sqrt(rX * rX + rY * rY) - gameInfo.sun_r;
    if (distanceFromSun < 30) {
        actions.push("hyperspace");
        console.log("Command Module is Hyperspacing.")
    }
    if (gameInfo[botVars["color"] + "_alive"]) {
        var angle = Math.degrees(Math.atan2(them.y - us.y, them.x - us.x)),
            rotationToOpponent = (us.rotation - angle + 360) % 360;
        if (rotationToOpponent > 90 && rotationToOpponent < 270) {
            actions.push("turn left");
        } else {
            actions.push("turn right");
        };
        actions.push("fire engine");
        if (Math.random() > 0.3) {
            actions.push("fire missile")
        }

    }
    return actions;
}

Basically just took Spy's code and flipped "left" and "right".

This bot is now live! And yes, it's fun to watch KamikazePlus chase Spy. :P

@El'endiaStarman I find it's fun to watch KamikazePlus fight itself with no bullets and overideHyperspace = 0;; they just keep missing when they try to go at each other.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Maximal Substring Construction
In this challenge, you are passed two things:

A string length, N
A list of strings, L, each with an assigned point value.  Any string that is not passed in has a point value of 0

You need to construct a string of length N such that the sum of all substring points is as large as possible.
For example:
5 [("ABC", 3), ("DEF", 4), ("CDG", 2)]

should output
ABCDG

Because the two substrings with points (ABC and CDG) have a total of 5 points, and no other possible construction can give 5 or more points.
Substrings can be used multiple times in a string, and can overlap.  You can assume that the points will always be positive, the substring lengths will be between 1 to N characters longs, and that N > 0.  If multiple constructions are maximal, print any one of them.
Your program must run in a reasonable amount of time (no more than a minute for each of the examples):
1 [("A", 7), ("B", 4), ("C", 100)]     => C
2 [("A", 2), ("B", 3), ("AB", 2)]      => AB
2 [("A", 1), ("B", 2), ("CD", 3)]      => BB
2 [("AD", 1), ("B", 2), ("ZB", 3)]     => ZB
3 [("AB", 2), ("BC", 1), ("CA", 3)]    => CAB
3 [("ABC", 4), ("DEF", 4), ("E", 1)]   => DEF
4 [("A", 1), ("BAB", 2), ("ABCD", 3)]  => AAAA or ABAB or BABA or ABCD
5 [("A", 1), ("BAB", 2), ("ABCD", 3)]  => BABCD or BABAB
5 [("ABC", 3), ("DEF", 4), ("CDG", 2)] => ABCDG
5 [("AB", 10), ("BC", 2), ("CA", 2)]   => ABCAB
6 [("AB", 10), ("BC", 2), ("CA", 2)]   => ABABAB
8 [("AA", 3), ("BA", 5)]               => BAAAAAAA
10 [("ABCDE", 19), ("ACEBD",  18), ("ABEDC", 17), ("BCEDA", 16), ("EBDAC", 15), ("BACD", 14), ("CADB", 13), ("ABDC", 12), ("CABD", 11), ("EBDC", 10), ("ACE", 9), ("CBA", 8), ("AEC", 7), ("BE", 6), ("AE", 5), ("DC", 4), ("BA", 3), ("A", 2), ("D", 1)]
=> ACEBDACEBD

This is a code-golf, so prepare your shortest answer in your favorite language!

Do we have to use your exact input format or can we use any convenient input format for our language?

@flawr any convenient method of input is fine (dictionary, stdin, function params)

The DEF tuple missing a comma

I have a perfectly nice solution, but it's too slow for the last test case.

@isaacg post it, I'll see if my time limit needs to change.

@NathanMerrill No, it's a pure brute-force solution. The time-limit is fine.

@isaacg yeah that was the purpose of my last test case.  I'm trying to get a smart solution, which I'm hoping exists.

@isaacg I have an elegant solution, sadly this comment is too small to contain it. (I don't, just wanted to cite Fermat.)

Python3, 383 bytes:
lambda t,s,k={}:max(f(s,'',t,0,k),key=lambda x:x[1])[0]
C=lambda l,a:(l[:len(a)]==a)+(0if''==l else C(l[1:],a))
def U(l,a,k):
 if(l,a)in k:return k[(l,a)]
 k[(l,a)]=C(l,a);return k[(l,a)]
def f(s,l,t,p,k):
 if(T:=len(l))==t:yield(l,sum(b*U(l,a,k)for a,b in s));return
 for a,b in s:
  for i in range(len(a)):
   if l[T-i:]==a[:i]and T<len(L:=(l[:T-i]+a))<=t:yield from f(s,L,t,p+b,k)

Try it online!

You can remove the space at 0 if for -1, and you can also create a constant for the four len(l) for another -11 (by replacing the first if len(l)==t with if(x:=len(l))==t). Also, I'm not entirely sure, but I think k[(l,a)]=C(l,a);return k[(l,a)] can simply be return C(l,a), in which case the entire method U can be U=lambda l,a,k:(l,a)in k and k[(l,a)]or C(l,a) for another -29.

@KevinCruijssen Thank you, updated. I did preserve U, as the caching is necessary for the program to run in under a minute for each test case.

Ah ok, that makes sense. I hadn't looked closely at what the actual program was doing, but it makes sense that method U is used for the caching portion. :)

362 (footer stripped to save space)

Python 2.7, 503 Bytes
This isn't particularly golfed, nor is it particularly efficient; it's just a relatively condensed enumeration of feasible strings that are brute-forced.  I don't think it would be too hard to create an admissible heuristic to use with A*, which would probably be a bit quicker.  I didn't bother doing that, though, because this method solves all of the examples in about 47 seconds on my laptop.
import re
v=lambda l,s:sum([len([m.start() for m in re.finditer('(?=%s)'%u,s)])*v for u,v in l])
def m(n,l,e):
 if len(e)==n:
  yield e
 else:
  u=1
  for s,v in sorted(l,key=lambda j:j[1],reverse=True):
   for i in range(len(s)-1,0,-1):
    if len(e)+len(s)-i <= n and e.endswith(s[:i]):
     for r in m(n,l,e+s[i:]):
      u=0;yield r
   if len(e)+len(s)<=n:
    for r in m(n,l,e+s):
     u=0;yield r
  if u:
   yield e
def p(n,l):
 b,r=-1,0
 for s in m(n,l,''):
  a=v(l,s)
  if a>b:b,r=a,s
 return r

To test it:
if __name__ == "__main__":
    for n, l in [
            (1, [("A", 7), ("B", 4), ("C", 100)]),     # => C
            (2, [("A", 2), ("B", 3), ("AB", 2)]),      # => AB
            (2, [("A", 1), ("B", 2), ("CD", 3)]),      # => BB
            (2, [("AD", 1), ("B", 2), ("ZB", 3)]),     # => ZB
            (3, [("AB", 2), ("BC", 1), ("CA", 3)]),    # => CAB
            (3, [("ABC", 4), ("DEF", 4), ("E", 1)]),   # => DEF
            (4, [("A", 1), ("BAB", 2), ("ABCD", 3)]),  # => AAAA or ABAB or BABA or ABCD
            (5, [("A", 1), ("BAB", 2), ("ABCD", 3)]),  # => BABCD or BABAB
            (5, [("ABC", 3), ("DEF", 4), ("CDG", 2)]), # => ABCDG
            (5, [("AB", 10), ("BC", 2), ("CA", 2)]),   # => ABCAB
            (6, [("AB", 10), ("BC", 2), ("CA", 2)]),   # => ABABAB
            (8, [("AA", 3), ("BA", 5)]),               # => BAAAAAAA
            (10, [("ABCDE", 19), ("ACEBD",  18), ("ABEDC", 17), ("BCEDA", 16), ("EBDAC", 15), ("BACD", 14), ("CADB", 13), ("ABDC", 12), ("CABD", 11), ("EBDC", 10), ("ACE", 9), ("CBA", 8), ("AEC", 7), ("BE", 6), ("AE", 5), ("DC", 4), ("BA", 3), ("A", 2), ("D", 1)]) # => ACEBDACEBD
    ]:
        print p(n, l)

Explanation
The v function simply calculates the value of a given string by searching for all occurrences of the substrings in L.  The m function enumerates all strings of length n with prefix e that can be generated from the substrings in l.  m recursively calls itself; the first call should pass in '' for e.  For example:
>>> for s in m(4, [("A", 1), ("BAB", 2), ("ABCD", 3)], ''):print s
ABCD
BABA
ABCD
ABAB
AAAA

The p function simply loops through all possible strings (as enumerated by m) and returns the one with highest value (as determined by v).
Note that the m function actually prioritizes the enumeration by sorting based on substrings' values.  This turns out to be unnecessary to ensure optimality, and it actually hinders efficiency a bit; I could save ~20 or so bytes by removing it.
Try it online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/