<commit_before>from definitions import classes, races
from objects import tiles
import random


class_list 	= classes.roster
race_list 	= races.roster


# Generates a 8-digit seed if one was not provided.
def seed (seed=None):

	if seed == None or seed == '':
		seed = []
		for i in range(8):
			seed.append(str(random.randint(0,9)))
		return ''.join(seed)
	else:
		return seed


# Provides a random race and class for the character.
def character (seed=None):

	random.seed(seed)

	random_race = race_list[random.randint(0, len(race_list) - 1)]
	random_class = random.choice(sorted(list(class_list.keys())))
	return {'race': random_race, 'class': random_class}


# Generates a random dungeon map.
def dungeon (x, y, seed=None):

	"""
	Example of intended generation:

	world = dungeon(3,3)
	[
		[1, 2, 3],
		[4, 5, 6],
		[7, 8, 9]
	]
	world[0][1] = 2

	@ = Player
	X = Enemy
	& = Boss
	$ = Loot
	~ = Key
	% = NPC
	# = Locked door (requires key)
	: = Entrance / Exit (randomly placed)
		- Exit should be locked until the boss is destroyed

	+---+---+---+
	| $   X | ~ |
	+---+   +   +
	: @   %     :
	+   +---+   +
	| X | & #   |
	+---+---+---+
	"""

	random.seed(seed)
	dungeon_map = []

	for i in range(y):

		row = []

		for j in range(x):

			walls = {
				'north' 	: False,
				'east'		: False,
				'south'		: False,
				'west'		: False
			}

			entities = {
				'items' = [],
				'objects' = [],
				'enemies' = [],
				'npcs' = []
			}

			row.append(tiles.DungeonTile(walls, entities))

		dungeon_map.append(row)<commit_msg>mapgen cleanup??<commit_after>from definitions import classes, races
from objects import tiles
import random


class_list 	= classes.roster
race_list 	= races.roster


# Generates a 8-digit seed if one was not provided.
def seed (seed=None):

	if seed == None or seed == '':
		seed = []
		for i in range(8):
			seed.append(str(random.randint(0,9)))
		return ''.join(seed)
	else:
		return seed


# Provides a random race and class for the character.
def character (seed=None):

	random.seed(seed)

	random_race = race_list[random.randint(0, len(race_list) - 1)]
	random_class = random.choice(sorted(list(class_list.keys())))
	return {'race': random_race, 'class': random_class}


# Generates a random dungeon map.
def dungeon (x, y, seed=None):

	"""
	Example of intended generation:

	world = dungeon(3,3)
	[
		[1, 2, 3],
		[4, 5, 6],
		[7, 8, 9]
	]
	world[0][1] = 2

	@ = Player
	X = Enemy
	& = Boss
	$ = Loot
	~ = Key
	% = NPC
	# = Locked door (requires key)
	: = Entrance / Exit (randomly placed)
		- Exit should be locked until the boss is destroyed

	+---+---+---+
	| $   X | ~ |
	+---+   +   +
	: @   %     :
	+   +---+   +
	| X | & #   |
	+---+---+---+
	"""

	random.seed(seed)
	dungeon_map = []

	for i in range(y):

		row = []

		for j in range(x):

			walls = {
				'north' 	: False,
				'east'		: False,
				'south'		: False,
				'west'		: False
			}

			entities = {
				'items': [],
				'objects': [],
				'enemies': [],
				'npcs': []
			}

			row.append(tiles.DungeonTile(walls, entities))

		dungeon_map.append(row)
{'fraction_non_alphanumeric': 0.1743388834476004, 'fraction_numerical': 0.01305909239307868, 'mean_word_length': 2.6476190476190475, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1043308', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1202, 'n_words': 296}