#! /usr/bin/env python3

def bit0_is_on(bp):
  if bp % 2 == 0:
    return 0
  else:
    return 1

def same(arg):
    return arg

def bit_is_on(bp, index):
  return bit0_is_on(bp >> index)

def print_truth_table(f):
  print(f'#  x y | f')
  print(f'   0 0 | {f[0]}')
  print(f'   0 1 | {f[1]}')
  print(f'   1 0 | {f[2]}')
  print(f'   1 1 | {f[3]}')

for i in range(16):
  f = [
    bit_is_on(i, 0),
    bit_is_on(i, 1),
    bit_is_on(i, 2),
    same(bit_is_on(i, 3)),
  ]
  print_truth_table(f)
