-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnamed_rows.py
More file actions
24 lines (18 loc) · 825 Bytes
/
named_rows.py
File metadata and controls
24 lines (18 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""This file contains definitions for named rows"""
import itertools
def Rounds(n_bells):
return tuple( range(1, n_bells+1) )
def Backrounds(n_bells):
return tuple( range(n_bells, 0, -1) )
def Queens(n_bells):
if n_bells % 2 != 0:
raise Exception('Queens definition only good on even numbers of bells')
return tuple( range(1,n_bells+1,2) + range(2,n_bells+1,2) )
def Kings(n_bells):
if n_bells % 2 != 0:
raise Exception('Kings definition only good on even numbers of bells')
return tuple( range(n_bells-1,0,-2) + range(2,n_bells+1,2) )
def Tittums(n_bells):
if n_bells % 2 != 0:
raise Exception('Tittums definition only good on even numbers of bells')
return tuple( itertools.chain.from_iterable( zip(range(1, n_bells/2 + 1), range(n_bells/2 + 1, n_bells+1)) ))