Skip to main content
deleted 86 characters in body
Source Link
RamenChef
  • 1.2k
  • 13
  • 27

Tit-For-Stat

Defects if the opponent has defected more than half the time.

def tit_for_stat(m, t, s):
  count = 0
  for i in xrange(len(m)):
    if t[i] == 'd':
      count++
  if t.count('d') * 2 > len(m):
    return 'd'
  else:
    return 'c'

Tit-For-Stat

Defects if the opponent has defected more than half the time.

def tit_for_stat(m, t, s):
  count = 0
  for i in xrange(len(m)):
    if t[i] == 'd':
      count++
  if count * 2 > len(m):
    return 'd'
  else:
    return 'c'

Tit-For-Stat

Defects if the opponent has defected more than half the time.

def tit_for_stat(m, t, s):
  if t.count('d') * 2 > len(m):
    return 'd'
  else:
    return 'c'
Source Link
RamenChef
  • 1.2k
  • 13
  • 27

Tit-For-Stat

Defects if the opponent has defected more than half the time.

def tit_for_stat(m, t, s):
  count = 0
  for i in xrange(len(m)):
    if t[i] == 'd':
      count++
  if count * 2 > len(m):
    return 'd'
  else:
    return 'c'