コード例 #1
0
ファイル: base.py プロジェクト: robbert-harms/musical-games
    def count_unique_compositions(self):
        """Get a count of the number of unique compositions possible from the tracts in this instrument.

        Returns:
            int: the number of unique compositions
        """
        from musical_games.dice_games.utils import find_duplicate_bars

        if self.dice_tables_linked:
            duplicates = find_duplicate_bars(list(t.bars for t in self.staffs))
            return self.staffs[0].dice_table.count_unique_combinations(duplicates)
        else:
            prod = 1
            for tract in self.staffs:
                prod *= tract.dice_table.count_unique_combinations(find_duplicate_bars([tract.bars]))
            return prod
コード例 #2
0
    def count_unique_compositions(self):
        """Get a count of the number of unique compositions possible from the tracts in this instrument.

        Returns:
            int: the number of unique compositions
        """
        from musical_games.dice_games.utils import find_duplicate_bars

        if self.dice_tables_linked:
            duplicates = find_duplicate_bars(list(t.bars for t in self.staffs))
            return self.staffs[0].dice_table.count_unique_combinations(
                duplicates)
        else:
            prod = 1
            for tract in self.staffs:
                prod *= tract.dice_table.count_unique_combinations(
                    find_duplicate_bars([tract.bars]))
            return prod
コード例 #3
0
    def get_duplicates(self, staff=None):
        """Get the duplicate measures using the given staffs to find the duplicates.

        This is useful if you want to mark in the dice table all measures that have duplicates somewhere.

        Args:
            staff (str): the staff to use when finding the duplicates. If None we use all the staffs.

        Returns:
            list of list of int: the duplicate measures the list of dice table ids in which that measure occurs
        """
        from musical_games.dice_games.utils import find_duplicate_bars

        if staff:
            for st in self.staffs:
                if st.name == staff:
                    return find_duplicate_bars([st.bars])
        else:
            return find_duplicate_bars(list(s.bars for s in self.staffs))
コード例 #4
0
ファイル: base.py プロジェクト: robbert-harms/musical-games
    def get_duplicates(self, staff=None):
        """Get the duplicate measures using the given staffs to find the duplicates.

        This is useful if you want to mark in the dice table all measures that have duplicates somewhere.

        Args:
            staff (str): the staff to use when finding the duplicates. If None we use all the staffs.

        Returns:
            list of list of int: the duplicate measures the list of dice table ids in which that measure occurs
        """
        from musical_games.dice_games.utils import find_duplicate_bars

        if staff:
            for st in self.staffs:
                if st.name == staff:
                    return find_duplicate_bars([st.bars])
        else:
            return find_duplicate_bars(list(s.bars for s in self.staffs))