import numpy

import GenerateRandomData  as GenData
from Robot import  OurRobot



class SRobot:

    def __init__(self, id, robot_num):

        self.PID = id

        self.robot_num = robot_num

        self.history_data = []

        self.return_data = robot_num



    def cal_data(self,robot,currentiter,Iteration,TotalRobot):



        value = OurRobot(robot, currentiter, Iteration, TotalRobot-1)

        return value   #self.return_data



    def update_data(self, vector):

        self.history_data.append(vector)

        return 0



class DummyRobot:

    def __init__(self, id, robot_num):

        self.PID = id

        self.robot_num = robot_num



    def cal_data(self,robot,currentiter,Iteration,TotalRobot):
        if self.PID == TotalRobot -1:
            return TotalRobot
        elif self.PID == TotalRobot -2:
            return GenData.GenOutput_normal(TotalRobot)
        elif self.PID == TotalRobot -3:
            return GenData.GenOutput_beta(TotalRobot)
        elif self.PID < TotalRobot -6:
            seed = GenData.RandomData(Iteration)
            if seed >=7:
                return GenData.GenOutput_normal(TotalRobot)
            elif seed >=4 or seed <7:
                return GenData.GenOutput_beta(TotalRobot)
            elif seed >=2 or seed <4:
                return np.random.randint((TotalRobot+1) / 2, TotalRobot+1)
            else: 
                return TotalRobot - seed
        else:
            return GenData.GenOutput_beta(TotalRobot) #numpy.random.randint(1, TotalRobot + 1)
            



    def update_data(self, vector):

        return 0

bca0eea1aac2b9e83fc29be99364939862c499df
<mask token>


class DummyRobot:

    def __init__(self, id, robot_num):
        self.PID = id
        self.robot_num = robot_num
    <mask token>

    def update_data(self, vector):
        return 0

<mask token>


class SRobot:
    <mask token>
    <mask token>
    <mask token>


class DummyRobot:

    def __init__(self, id, robot_num):
        self.PID = id
        self.robot_num = robot_num

    def cal_data(self, robot, currentiter, Iteration, TotalRobot):
        if self.PID == TotalRobot - 1:
            return TotalRobot
        elif self.PID == TotalRobot - 2:
            return GenData.GenOutput_normal(TotalRobot)
        elif self.PID == TotalRobot - 3:
            return GenData.GenOutput_beta(TotalRobot)
        elif self.PID < TotalRobot - 6:
            seed = GenData.RandomData(Iteration)
            if seed >= 7:
                return GenData.GenOutput_normal(TotalRobot)
            elif seed >= 4 or seed < 7:
                return GenData.GenOutput_beta(TotalRobot)
            elif seed >= 2 or seed < 4:
                return np.random.randint((TotalRobot + 1) / 2, TotalRobot + 1)
            else:
                return TotalRobot - seed
        else:
            return GenData.GenOutput_beta(TotalRobot)

    def update_data(self, vector):
        return 0

<mask token>


class SRobot:
    <mask token>
    <mask token>

    def update_data(self, vector):
        self.history_data.append(vector)
        return 0


class DummyRobot:

    def __init__(self, id, robot_num):
        self.PID = id
        self.robot_num = robot_num

    def cal_data(self, robot, currentiter, Iteration, TotalRobot):
        if self.PID == TotalRobot - 1:
            return TotalRobot
        elif self.PID == TotalRobot - 2:
            return GenData.GenOutput_normal(TotalRobot)
        elif self.PID == TotalRobot - 3:
            return GenData.GenOutput_beta(TotalRobot)
        elif self.PID < TotalRobot - 6:
            seed = GenData.RandomData(Iteration)
            if seed >= 7:
                return GenData.GenOutput_normal(TotalRobot)
            elif seed >= 4 or seed < 7:
                return GenData.GenOutput_beta(TotalRobot)
            elif seed >= 2 or seed < 4:
                return np.random.randint((TotalRobot + 1) / 2, TotalRobot + 1)
            else:
                return TotalRobot - seed
        else:
            return GenData.GenOutput_beta(TotalRobot)

    def update_data(self, vector):
        return 0

<mask token>


class SRobot:

    def __init__(self, id, robot_num):
        self.PID = id
        self.robot_num = robot_num
        self.history_data = []
        self.return_data = robot_num

    def cal_data(self, robot, currentiter, Iteration, TotalRobot):
        value = OurRobot(robot, currentiter, Iteration, TotalRobot - 1)
        return value

    def update_data(self, vector):
        self.history_data.append(vector)
        return 0


class DummyRobot:

    def __init__(self, id, robot_num):
        self.PID = id
        self.robot_num = robot_num

    def cal_data(self, robot, currentiter, Iteration, TotalRobot):
        if self.PID == TotalRobot - 1:
            return TotalRobot
        elif self.PID == TotalRobot - 2:
            return GenData.GenOutput_normal(TotalRobot)
        elif self.PID == TotalRobot - 3:
            return GenData.GenOutput_beta(TotalRobot)
        elif self.PID < TotalRobot - 6:
            seed = GenData.RandomData(Iteration)
            if seed >= 7:
                return GenData.GenOutput_normal(TotalRobot)
            elif seed >= 4 or seed < 7:
                return GenData.GenOutput_beta(TotalRobot)
            elif seed >= 2 or seed < 4:
                return np.random.randint((TotalRobot + 1) / 2, TotalRobot + 1)
            else:
                return TotalRobot - seed
        else:
            return GenData.GenOutput_beta(TotalRobot)

    def update_data(self, vector):
        return 0

import numpy

import GenerateRandomData  as GenData
from Robot import  OurRobot



class SRobot:

    def __init__(self, id, robot_num):

        self.PID = id

        self.robot_num = robot_num

        self.history_data = []

        self.return_data = robot_num



    def cal_data(self,robot,currentiter,Iteration,TotalRobot):



        value = OurRobot(robot, currentiter, Iteration, TotalRobot-1)

        return value   #self.return_data



    def update_data(self, vector):

        self.history_data.append(vector)

        return 0



class DummyRobot:

    def __init__(self, id, robot_num):

        self.PID = id

        self.robot_num = robot_num



    def cal_data(self,robot,currentiter,Iteration,TotalRobot):
        if self.PID == TotalRobot -1:
            return TotalRobot
        elif self.PID == TotalRobot -2:
            return GenData.GenOutput_normal(TotalRobot)
        elif self.PID == TotalRobot -3:
            return GenData.GenOutput_beta(TotalRobot)
        elif self.PID < TotalRobot -6:
            seed = GenData.RandomData(Iteration)
            if seed >=7:
                return GenData.GenOutput_normal(TotalRobot)
            elif seed >=4 or seed <7:
                return GenData.GenOutput_beta(TotalRobot)
            elif seed >=2 or seed <4:
                return np.random.randint((TotalRobot+1) / 2, TotalRobot+1)
            else: 
                return TotalRobot - seed
        else:
            return GenData.GenOutput_beta(TotalRobot) #numpy.random.randint(1, TotalRobot + 1)
            



    def update_data(self, vector):

        return 0
