

STRATEGIES = [ "coop", "defect", "randy", "randomness"];


//////////////////////////////////////////////////////////////////////////////

function coop(myHistory, yourHistory)
// Given  : myHistory and yourHistory are strings of C's and D's (same length)
// Returns: "C"
{
    return "C"
}

function defect(myHistory, yourHistory)
// Given  : myHistory and yourHistory are strings of C's and D's (same length)
// Returns: "D"
{
    return "D"
}

function randomness(myHistory, yourHistory)
// Given  : myHistory and yourHistory are strings of C's and D's (same length)
// Returns: either "C" or "D" (with equal likelihood)
{
    return randomItem(["C", "D"]);
}

function titForTat(myHistory, yourHistory)
// Given  : myHistory and yourHistory are strings of C's and D's (same length)
// Returns: whatever opponent did last (last character in yourHistory)
{
    if (yourHistory == "") {
        return "C";
    }
    else {
        return yourHistory.charAt(yourHistory.length-1);
    }
}

