Clean up RoomGenerator.Configuration
This commit is contained in:
		
							parent
							
								
									b9c45f44b2
								
							
						
					
					
						commit
						e2553cca3b
					
				
					 1 changed files with 4 additions and 10 deletions
				
			
		| 
						 | 
					@ -1,7 +1,6 @@
 | 
				
			||||||
# Eryn Wells <eryn@erynwells.me>
 | 
					# Eryn Wells <eryn@erynwells.me>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import random
 | 
					import random
 | 
				
			||||||
from copy import copy
 | 
					 | 
				
			||||||
from dataclasses import dataclass
 | 
					from dataclasses import dataclass
 | 
				
			||||||
from typing import List, Optional, TYPE_CHECKING
 | 
					from typing import List, Optional, TYPE_CHECKING
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,18 +20,13 @@ class RoomGenerator:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @dataclass
 | 
					    @dataclass
 | 
				
			||||||
    class Configuration:
 | 
					    class Configuration:
 | 
				
			||||||
        number_of_rooms: int
 | 
					        number_of_rooms: int = 30
 | 
				
			||||||
        minimum_room_size: Size
 | 
					        minimum_room_size: Size = Size(7, 7)
 | 
				
			||||||
        maximum_room_size: Size
 | 
					        maximum_room_size: Size = Size(20, 20)
 | 
				
			||||||
 | 
					 | 
				
			||||||
    DefaultConfiguration = Configuration(
 | 
					 | 
				
			||||||
        number_of_rooms=30,
 | 
					 | 
				
			||||||
        minimum_room_size=Size(7, 7),
 | 
					 | 
				
			||||||
        maximum_room_size=Size(20, 20))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self, *, size: Size, config: Optional[Configuration] = None):
 | 
					    def __init__(self, *, size: Size, config: Optional[Configuration] = None):
 | 
				
			||||||
        self.size = size
 | 
					        self.size = size
 | 
				
			||||||
        self.configuration = config if config else copy(RoomGenerator.DefaultConfiguration)
 | 
					        self.configuration = config if config else RoomGenerator.Configuration()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.rooms: List[Room] = []
 | 
					        self.rooms: List[Room] = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue