28 lines
		
	
	
		
			630 B
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			28 lines
		
	
	
		
			630 B
		
	
	
	
		
			Python
		
	
	
	
	
	
|   | def peut_retirer(i, bag, jeu): | ||
|  |     """verifie si une baguette peut etre retiree """ | ||
|  |     on_top = bag[:] | ||
|  |     for intersection in jeu: | ||
|  |         if intersection[1] in on_top: | ||
|  |             on_top.remove(intersection[1]) | ||
|  |     return i in on_top | ||
|  | 
 | ||
|  | 
 | ||
|  | def retirer(i, bag, jeu): | ||
|  |     bag.remove(i) | ||
|  |     for intersection in jeu: | ||
|  |         if i in intersection: | ||
|  |             jeu.remove(intersection) | ||
|  | 
 | ||
|  | 
 | ||
|  | if __name__ == "__main__": | ||
|  |     from ex5 import creer_mikado | ||
|  | 
 | ||
|  |     bag = list(range(10)) | ||
|  |     game = creer_mikado(bag) | ||
|  |     print(game) | ||
|  |     retirer(5, bag, game) | ||
|  |     print(game) | ||
|  |     # print(bag) | ||
|  |     # print(game) | ||
|  |     # print(peut_retirer(5, bag, game)) |