<commit_before>#   ___     _       ___  ___ _   |  
#  / _ \ __| |_ ___| _ \/ __| |  |  Create 8-bit-like games!
# | (_) / _|  _/ _ \  _/ (_ |_|  |  Author: Death_Miner
#  \___/\__|\__\___/_|  \___(_)  |  Version: 0.2.0
#                                |  
#
# @ octopg/events.py => This file catches events like buttons presses

import pygame as pg
import sys
import octopg.data as data
import copy

# Virtual controller events
CNTLR_KEYDOWN = 2000
CNTLR_KEYUP = 2001

# Xbox360 controller event
X360_CNTRL_DOWN = 2026
X360_CNTRL_UP = 2027

# Buttons IDs for testing
# Global buttons, for both p1 and p2
BTN_LEFT = 2002
BTN_UP = 2003
BTN_DOWN = 2004
BTN_RIGHT = 2005
BTN_SELECT = 2006
BTN_START = 2007
BTN_B = 2008
BTN_A = 2009

# P1 Buttons
P1_BTN_LEFT = 2010
P1_BTN_UP = 2011
P1_BTN_DOWN = 2012
P1_BTN_RIGHT = 2013
P1_BTN_SELECT = 2014
P1_BTN_START = 2015
P1_BTN_B = 2016
P1_BTN_A = 2017

# P2 Buttons
P2_BTN_LEFT = 2018
P2_BTN_UP = 2019
P2_BTN_DOWN = 2020
P2_BTN_RIGHT = 2021
P2_BTN_SELECT = 2022
P2_BTN_START = 2023
P2_BTN_B = 2024
P2_BTN_A = 2025

# Current configuration & default
CONFIG = {
	"p1": {
		"controller": -1,
		"keyboard": {
			"left": pg.K_a,
			"up": pg.K_w,
			"down": pg.K_s,
			"right": pg.K_d,
			"select": pg.K_g,
			"start": pg.K_h,
			"b": pg.K_k,
			"a": pg.K_SEMICOLON
		},
		"joystick": {
			"left": -1,
			"up": -1,
			"down": -1,
			"right": -1,
			"select": -1,
			"start": -1,
			"b": -1,
			"a": -1
		}
	},
	"p2": {
		"controller": -1,
		"keyboard": {
			"left": -1,
			"up": -1,
			"down": -1,
			"right": -1,
			"select": -1,
			"start": -1,
			"b": -1,
			"a": -1
		},
		"joystick": {
			"left": -1,
			"up": -1,
			"down": -1,
			"right": -1,
			"select": -1,
			"start": -1,
			"b": -1,
			"a": -1
		}
	}
}

BTN_STATES = {
	'PRESSED':{
		P1_BTN_LEFT: False,
		P1_BTN_UP: False,
		P1_BTN_DOWN: False,
		P1_BTN_RIGHT: False,
		P1_BTN_SELECT: False,
		P1_BTN_START: False,
		P1_BTN_B: False,
		P1_BTN_A: False,
		P2_BTN_LEFT: False,
		P2_BTN_UP: False,
		P2_BTN_DOWN: False,
		P2_BTN_RIGHT: False,
		P2_BTN_SELECT: False,
		P2_BTN_START: False,
		P2_BTN_B: False,
		P2_BTN_A: False
	}
}

print(BTN_STATES)

x360_cntrl_requirements = {
	"axes": 5,
	"buttons": 10,
	"hats": 1
}

x360_cntrl_map_reverse = {
	"button":{
		0: "a",
		1: "b",<commit_msg>Cleaner code #2<commit_after>#   ___     _       ___  ___ _   |  
#  / _ \ __| |_ ___| _ \/ __| |  |  Create 8-bit-like games!
# | (_) / _|  _/ _ \  _/ (_ |_|  |  Author: Death_Miner
#  \___/\__|\__\___/_|  \___(_)  |  Version: 0.2.0
#                                |  
#
# @ octopg/events.py => This file catches events like buttons presses

import pygame as pg
import sys
import octopg.data as data
import copy

# Virtual controller events
CNTLR_KEYDOWN = 2000
CNTLR_KEYUP = 2001

# Xbox360 controller event
X360_CNTRL_DOWN = 2026
X360_CNTRL_UP = 2027

# Buttons IDs for testing
# Global buttons, for both p1 and p2
BTN_LEFT = 2002
BTN_UP = 2003
BTN_DOWN = 2004
BTN_RIGHT = 2005
BTN_SELECT = 2006
BTN_START = 2007
BTN_B = 2008
BTN_A = 2009

# P1 Buttons
P1_BTN_LEFT = 2010
P1_BTN_UP = 2011
P1_BTN_DOWN = 2012
P1_BTN_RIGHT = 2013
P1_BTN_SELECT = 2014
P1_BTN_START = 2015
P1_BTN_B = 2016
P1_BTN_A = 2017

# P2 Buttons
P2_BTN_LEFT = 2018
P2_BTN_UP = 2019
P2_BTN_DOWN = 2020
P2_BTN_RIGHT = 2021
P2_BTN_SELECT = 2022
P2_BTN_START = 2023
P2_BTN_B = 2024
P2_BTN_A = 2025

# Current configuration & default
CONFIG = {
	"p1": {
		"controller": -1,
		"keyboard": {
			"left": pg.K_a,
			"up": pg.K_w,
			"down": pg.K_s,
			"right": pg.K_d,
			"select": pg.K_g,
			"start": pg.K_h,
			"b": pg.K_k,
			"a": pg.K_SEMICOLON
		},
		"joystick": {
			"left": -1,
			"up": -1,
			"down": -1,
			"right": -1,
			"select": -1,
			"start": -1,
			"b": -1,
			"a": -1
		}
	},
	"p2": {
		"controller": -1,
		"keyboard": {
			"left": -1,
			"up": -1,
			"down": -1,
			"right": -1,
			"select": -1,
			"start": -1,
			"b": -1,
			"a": -1
		},
		"joystick": {
			"left": -1,
			"up": -1,
			"down": -1,
			"right": -1,
			"select": -1,
			"start": -1,
			"b": -1,
			"a": -1
		}
	}
}

BTN_STATES = {
	'PRESSED':{
		P1_BTN_LEFT: False,
		P1_BTN_UP: False,
		P1_BTN_DOWN: False,
		P1_BTN_RIGHT: False,
		P1_BTN_SELECT: False,
		P1_BTN_START: False,
		P1_BTN_B: False,
		P1_BTN_A: False,
		P2_BTN_LEFT: False,
		P2_BTN_UP: False,
		P2_BTN_DOWN: False,
		P2_BTN_RIGHT: False,
		P2_BTN_SELECT: False,
		P2_BTN_START: False,
		P2_BTN_B: False,
		P2_BTN_A: False
	}
}

x360_cntrl_requirements = {
	"axes": 5,
	"buttons": 10,
	"hats": 1
}

x360_cntrl_map_reverse = {
	"button":{
		0: "a",
		1: "b",
{'fraction_non_alphanumeric': 0.1609927520316275, 'fraction_numerical': 0.08851306830661103, 'mean_word_length': 2.669621273166801, 'pattern_counts': {'":': 88, '<': 3, '<?xml version=': 0, '>': 5, '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': '300359', 'n_tokens_mistral': 2689, 'n_tokens_neox': 2232, 'n_words': 462}