🐍 python python time

python

owly

闇の伝説
Staff member
戦闘 コーダー
time to translate the new auxiliary classes for the python version

project progress at 100%
 
0% 100%


  1. +AXGamification
  2. +TODOListManager
  3. +DrawRnd
  4. +AXLHub
  5. +AXLHousing
  6. +AXNeuroSama
  7. +AXLNeuroSama
  8. +AXLearnability
  9. +TrgTolerance
  10. +Cycler
  11. +Perchance
  12. +AXKeyValuePair
  13. +InputFilter // context juubi
  14. +strategy
  15. +AXStrategy
  16. +LGTypeConverter
  17. +OutputDripper
  18. +PersistantAnswer
  19. +UniqueItemSizeLimitedPriorityQueue

 
Last edited by a moderator:

fukurou

the supreme coder
ADMIN
Java:
public class AXGamification {
    // this auxiliary module can add fun to tasks, skills, and abilities simply by
    // tracking their usage, and maximum use count.
    private int counter = 0;
    private int max = 0;

    public int getCounter() {
        return counter;
    }

    public int getMax() {
        return max;
    }
    public void resetCount(){
        counter = 0;
    }
    public void resetAll(){
        max = 0;
        counter = 0;
    }
    public void increament(){
        counter++;
        if (counter > max) {
            max = counter;
        }
    }
}
 

fukurou

the supreme coder
ADMIN
Python:
class AXGamification:
    # this auxiliary module can add fun to tasks, skills, and abilities simply by
    # tracking their usage, and maximum use count.
    def __init__(self):
        self._counter: int = 0
        self._max: int = 0

    def getCounter(self) -> int:
        return self._counter

    def getMax(self) -> int:
        return self._max

    def resetCount(self):
        self._counter = 0

    def resetAll(self):
        self._counter = 0
        self._max = 0

    def increment(self):
        self._counter += 1
        if self._counter > self._max:
            self._max = self._counter
 

owly

闇の伝説
Staff member
戦闘 コーダー
fix the typo.
because of you I'm rocking 5 generators! just so I can stay online!!! :s79:
 

owly

闇の伝説
Staff member
戦闘 コーダー
I've been seeing too many lurkers in my command center lately. it's annoying. yes you, mister lurker.
join the party or buzz off. :s52:
Java:
public class Cycler {
    // cycles through numbers limit to 0 non-stop
    private int cycler = 0;
    private int limit;

    public Cycler(int limit) {
        super();
        this.limit = limit;
        cycler = limit;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }
    public int cycleCount() {
        cycler--;
        if (cycler < 0) {
            cycler = limit;
        }
        return cycler;
    }

    public void reset() {
        cycler = limit;
    }
    public void setToZero(){cycler = 0;}
    public void sync(int n){
        if((n<-1)||(n>limit)){
            return;
        }
        cycler = n;
    }
}
 

fukurou

the supreme coder
ADMIN
fuck you 2. I'm not the one who sent all them meeseekses.

Python:
class Cycler:
    # cycles through numbers limit to 0 non-stop
    def __init__(self, limit: int):
        self.limit: int = limit
        self._cycler: int = limit

    def cycleCount(self) -> int:
        self._cycler -= 1
        if self._cycler < 0:
            self._cycler = self.limit
        return self._cycler

    def reset(self):
        self._cycler = self.limit

    def setToZero(self):
        self._cycler = 0

    def sync(self, n:int):
        if n<-1 or n>self.limit:
            return
        self._cycler = n

I'm gone play some marvel ultimate alliance 3 or some shit. owl fuck
 

fukurou

the supreme coder
ADMIN
Java:
public class AXKeyValuePair {
    private String key = "";
    private String value = "";

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
 

fukurou

the supreme coder
ADMIN
Python:
class AXKeyValuePair:
    def __init__(self):
        self.key: str = ""
        self.value: str = ""
 
Last edited:

owly

闇の伝説
Staff member
戦闘 コーダー
Java:
public class LGTypeConverter {
    private RegexUtil r1 = new RegexUtil();
    public int convertToInt(String v1){
        String temp = r1.extractRegex(enumRegexGrimoire.integer, v1);
        if (temp.isEmpty()) {return 0;}
        return Integer.parseInt(temp);
    }
    public Double convertToDouble(String v1){
        String temp = r1.extractRegex(enumRegexGrimoire.double_num, v1);
        if (temp.isEmpty()) {return 0.0;}
        return Double.parseDouble(temp);
    }
}
 

fukurou

the supreme coder
ADMIN
Python:
class LGTypeConverter:
    # converts strings types to number typed variables
    def __init__(self):
        self.r1: RegexUtil = RegexUtil()

    def convertToInt(self, v1: str) -> int:
        temp: str = self.r1.extractEnumRegex(enumRegexGrimoire.integer,v1)
        if temp == "":
            return 0
        return int(temp)

    def convertToFloat(self, v1: str) -> int:
        temp: str = self.r1.extractEnumRegex(enumRegexGrimoire.double_num,v1)
        if temp == "":
            return 0
        return float(temp)

    def convertToFloat(self, v1: str, precision:int) -> int:
        # precision: how many numbers after the .
        temp: str = self.r1.extractEnumRegex(enumRegexGrimoire.double_num,v1)
        if temp == "":
            return 0
        return round(float(temp),precision)
 

owly

闇の伝説
Staff member
戦闘 コーダー
Java:
public class DrawRnd {
    // draw a random element, than take said element out
    private ArrayList<String> strings = new ArrayList<>();
    private ArrayList<String> stringsSource = new ArrayList<>();
    private Random rand = new Random();
    public DrawRnd(String... values) {
        for (int i = 0; i < values.length; i++) {
            strings.add(values[i]);
            stringsSource.add(values[i]);
        }
    }
    public String draw(){
        if (strings.isEmpty()) {return "";}

        int x = rand.nextInt(strings.size());
        String element = strings.get(x);
        strings.remove(x);
        return element;
    }
    public int getSimpleRNDNum(int bound){
        // return 0->bound-1
        return rand.nextInt(bound);
    }
    private LGTypeConverter tc = new LGTypeConverter();
    public int drawAsInt(){
        if (strings.isEmpty()) {return 0;}
        Random rand = new Random();
        int x = rand.nextInt(strings.size());
        String element = strings.get(x);
        strings.remove(x);
        return tc.convertToInt(element);
    }
    public void reset(){
        DeepCopier dc = new DeepCopier();
        strings = dc.copyList(stringsSource);
    }
}


pump up the volume ! it's codin party time !! :s72:
 

fukurou

the supreme coder
ADMIN
5 generators up this biyatch!!!!!
how bout I kick your ass and say you fell or something? then you and your team or whatever can do whatever shit it is you do and let me just chill? how bout that you owl fuck?
 

fukurou

the supreme coder
ADMIN
Python:
class DrawRnd:
    # draw a random element, than take said element out
    def __init__(self, *values: str):
        self.converter: LGTypeConverter = LGTypeConverter()
        self.strings: LGFIFO = LGFIFO()
        self._stringsSource:list[str] = []
        for i in range(0, len(values)):
            self.strings.insert(values[i])
            self._stringsSource.append(values[i])

    def drawAndRemove(self) -> str:
        temp: str = self.strings.getRNDElement()
        self.strings.removeItem(temp)
        return temp

    def drawAsIntegerAndRemove(self) -> int:
        temp: str = self.strings.getRNDElement()
        if temp is None:
            return 0
        self.strings.removeItem(temp)
        return self.converter.convertToInt(temp)

    def getSimpleRNDNum(self: int) -> int:
        return random.randint(0, self)

    def reset(self):
        self.strings.clear()
        for t in self._stringsSource:
            self.strings.insert(t)
 

fukurou

the supreme coder
ADMIN
Java:
public class UniqueItemSizeLimitedPriorityQueue extends UniqueItemsPriorityQue{
    // items in the queue are unique and do not repeat
    // the size of the queue is limited
    private int limit = 5;

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }

    @Override
    public void add(String item) {
        if(super.size() == limit){
            super.poll();}
        super.add(item);
    }

    @Override
    public String poll() {
        String temp = super.poll();
        if (temp == null){
            return "";
        }
        return temp;
    }

    @Override
    public String getRNDElement() {
        String temp = super.getRNDElement();
        if (temp == null){
            return "";
        }
        return temp;
    }

    public ArrayList<String> getAsList(){
        return getElements();
    }
}
 
Top