Skip to content

Instantly share code, notes, and snippets.

@benjtinsley
Created October 30, 2023 02:17
Show Gist options
  • Save benjtinsley/cfe7e60b0eaf0480376cba7a3020021b to your computer and use it in GitHub Desktop.
Save benjtinsley/cfe7e60b0eaf0480376cba7a3020021b to your computer and use it in GitHub Desktop.
Alternate division functions for mapping division probability
def flat_division(a, b):
'''Splitting a flat group of divisible entities into all possible partitions along X and Y axis. Denoted by a_|b'''
min = a+b
max = a*b+(a+b-1)
return list(range(min, max+1))
def stacked_division(a, b):
'''Splitting an overlapping group of divisible entities into all possible partitions along Z axis. Denoted by a/|b'''
min = a*b+a
max = 2*a*b
return list(range(min, max+1))
def flat_stacked_division(a,b):
'''Splitting a flat or overlapping group of divisible entities into all possible partitions along X, Y and Z axis. Denoted by a_/|b'''
min = a+b
max = 2*a*b
return list(range(min, max+1))
def distributed_division(a,b):
'''Splitting a group of indivisible entities into all possible group sizes. Denoted by a[|b'''
max = a-b+1
min = max+b-a
if min == max:
return max
return list(range(max+b-a, max+1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment