Exemple #1
0
def possibiliteDepart(delCase, ensDepart, sizemap):
    """retourne la case de depart (dans <ensDepart>) pour arriver à la case
    à supprimer <delCase>"""
    caseAutour = listerCaseAutour(delCase, sizemap)
    ensPossibleAutour = set()
    for case in caseAutour:
        if case in ensDepart:
            ensPossibleAutour.add(case)
    return choiceInSet(tuple(ensPossibleAutour))
Exemple #2
0
def genereMap(ensDepart, SIZEMAP):
    oldEns = set()
    ensPossibilite, oldEns = cherchePossibilite(ensDepart, oldEns, SIZEMAP)
    while ensPossibilite != set():
        delCase = choiceInSet(tuple(ensPossibilite))
        depCase = possibiliteDepart(delCase, ensDepart, SIZEMAP)
        ensDepart.add(delCase)
        delCase2 = ((delCase[0] - depCase[0]) / 2 + depCase[0],
                    (delCase[1] - depCase[1]) / 2 + depCase[1])
        ensDepart.add(delCase2)
        ensPossibilite, oldEns = cherchePossibilite(ensDepart, oldEns, SIZEMAP)
    return ensDepart