# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load

import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

# Input data files are available in the read-only "../input/" directory
# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory

import os
for dirname, _, filenames in os.walk('/kaggle/input'):
    for filename in filenames:
        print(os.path.join(dirname, filename))

# You can write up to 5GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using "Save & Run All" 
# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session
"""
Lets assume we have continous value y form space (-inf, + inf) and we wannt to convert it to discrete  n states, we want to split ininite area to equal ranges  it means that probability od each state is the same.

(-inf, + inf) ---> {x1,x2,x3,...,xn}

We can interprete continous value as number of rotation around point (0,0).

Example:
7.2 - means 7.2 rotation in clockwise direction
-3.2 -means 3.2 rotation in counter-clockwise direction 

Now we san split circle to n - states, for example:
action 0 - 'up' part 0
action 1 - 'left' part 1
action 2 - 'down' part 2
action 3 - 'right' part 3

"""
#lets try to convert y value for n=4 equal states
y=6.8
n=4
y_rest=y%1
print('y_rest=',y_rest)
part_size=1/n
part_number=y_rest//part_size
print('part_number=',part_number)

#write as function

def continous2discrete(y_con,n):
    y_rest=y_con%1
    part_size=1/n
    part_number=y_rest//part_size
    return int(part_number)
action=continous2discrete(-1.13,n=6)
print('action=',action)