The classic: tit-for-tat. Cooperates on the first turn, and thereafter copies the opponent's most recent choice.
- Source:
(require("lib/strategies/titfortat"))(history) → {Boolean}
Strategy function. Consumes history, returns a choice.
Parameters:
Name | Type | Description |
---|---|---|
history |
Array | An array of arrays of each strategy's choice from each round so far,
as |
- Source:
Returns:
A boolean representing whether the strategy chooses to cooperate (true
) or defect (false
).
- Type
- Boolean