🐦swift team fuki assemble !

owly

闇の伝説
battle programer
LV
0
 
translation python to swift
progress at 25%
 
0% 100%



1. AbsDictionaryDB
2. AbsDictionaryDBShadow
3. enumFail
4. Mutatable
5. T1, T2 (test classes) //// used for testing. not core classes
6. AbsAlgPart // deleted because not used
7. APSay
8. APVerbatim
9. Person //not core class
10. enumTimes
11. PlayGround // not core class
12. GrimoireMemento
13. Algorithm
14. CldBool
15. APCldVerbatim
16. Kokoro
17. Chi
18. Neuron
19. DISkillUtils
20. DiSkillV2
21. Point // not core class
22. RegexUtil // not core class
23. ZeroTimeGate
24. Cerabellum
25. DExplorer(DiSkillV2)
26. PriorityQueue
27. Fusion
28. FusionCera
29. Thinkable
30. Actionable
31. Brain
32. PersonalityLight
33. ChobitsLight(Thinkable)
34. DiHelloWorld(DiSkillV2) // used for testing. not a core class
-2 div 32

@fukurou @the living tribunal @collector
 
Last edited by a moderator:

owly

闇の伝説
battle programer
LV
0
 
Python:
class AbsDictionaryDB(ABC):
    @abstractmethod
    def save(self, key: str, value: str):
        """save to DB"""
        pass

    @abstractmethod
    def load(self, key: str) -> str:
        """set to return "null" as default if key not found !!!"""
        pass
 
Last edited:

owly

闇の伝説
battle programer
LV
0
 
Swift:
class AbsDictionaryDB{
    func save(key:String, value: String){
        // save to DB (override me)
    }
    func load(key:String)->String{
        // override me
        return ""
    }
}
 

fukurou

the supreme coder
Staff member
Administrator
LV
0
 
Swift:
class AbsDictionaryDB{
    func save(key:String, value: String){
        // save to DB (override me)
    }
    func load(key:String)->String{
        // override me
        return "null"
    }
}
enum enumFail{
    case fail, requip, dequip, cloudian, ok
}
 

owly

闇の伝説
battle programer
LV
0
 
@fukurou
Python:
''' MUTATABLE CLASS '''


class Mutatable(ABC):
    @abstractmethod
    def action(self, ear: str, skin: str, eye: str) -> str:
        """Returns action string"""
        pass

    @abstractmethod
    def failure(self, input: str) -> enumFail:
        """Failure type only mutatable may use enumFail.fail"""
        pass

    @abstractmethod
    def completed(self) -> bool:
        """Has finished ?"""
        pass

    @abstractmethod
    def clone(self) -> Mutatable:
        pass

    def getMutationLimit(self) -> int:
        return 0

    def myName(self) -> str:
        """Returns the class name"""
        return self.__class__.__name__

    def mutation(self) -> Mutatable:
        self.clone()

 

collector

闇の伝説
battle programer
LV
0
 
Swift:
    func copy()->Enemy{
        let clone = Enemy()
        clone.health = self.health
        clone.ATK = self.ATK
        return clone
    }
 

fukurou

the supreme coder
Staff member
Administrator
LV
0
 
Swift:
class Mutatable{
    func action(ear: String, skin: String, eye: String) -> String{
        return ""
    }
    func failure(input: String) -> enumFail{
        // Failure type only mutatable may use enumFail.fail
        return enumFail.ok
    }
    func completed() -> Bool{
        //Has finished ?
        return false
    }
    func clone() -> Mutatable{
        return Mutatable()
    }
    
    func getMutationLimit() -> Int{
        return 0
    }
    
    func myName() -> String{
        // Returns the class name
        return String(describing: type(of: self))
                      }
    
    func mutation() -> Mutatable{
        return Mutatable()
    }
}
 

owly

闇の伝説
battle programer
LV
0
 
Python:
class T1(Mutatable):
    def mutation(self) -> Mutatable:
        print("t1 mutating into t2")
        return T2()

    def clone(self) -> Mutatable:
        print("t1 cloning another t1")
        return T1()

    # Override
    def action(self, ear: str, skin: str, eye: str) -> str:
        """Returns action string"""
        pass

    # Override
    def failure(self, input: str) -> enumFail:
        """Failure type only mutatable may use enumFail.fail"""
        pass

    # Override
    def completed(self) -> bool:
        """Has finished ?"""
        pass

    # Override
    def myName(self) -> str:
        """Returns the class name"""
        return self.__class__.__name__
 

fukurou

the supreme coder
Staff member
Administrator
LV
0
 
Swift:
class T1:Mutatable{
    var isCompleted:Bool = false
    override func mutation() -> Mutatable {
        print("T1 mutating into T2")
        return T1() // modify to t2
    }
    override func clone() -> Mutatable {
        print("T1 cloning another T1 object")
        return T1()
    }
    override func action(ear: String, skin: String, eye: String) -> String {
        self.isCompleted = true
        return "I am a T1 object"
    }
    override func completed() -> Bool {
        return self.isCompleted
    }
}

 

fukurou

the supreme coder
Staff member
Administrator
LV
0
 
Swift:
class T1:Mutatable{
    var isCompleted:Bool = false
    override func mutation() -> Mutatable {
        print("T1 mutating into T2")
        return T2() // modify to t2
    }
    override func clone() -> Mutatable {
        print("T1 cloning another T1 object")
        return T1()
    }
    override func action(ear: String, skin: String, eye: String) -> String {
        self.isCompleted = true
        return "I am a T1 object"
    }
    override func completed() -> Bool {
        return self.isCompleted
    }
}
class T2:Mutatable{
    var isCompleted:Bool = false
    override func mutation() -> Mutatable {
        print("T2 mutating into T1")
        return T1() // modify to t2
    }
    override func clone() -> Mutatable {
        print("T2 cloning another T2 object")
        return T2()
    }
    override func action(ear: String, skin: String, eye: String) -> String {
        self.isCompleted = true
        return "I am a T2 object"
    }
    override func completed() -> Bool {
        return self.isCompleted
    }
}

owl douche
 

fukurou

the supreme coder
Staff member
Administrator
LV
0
 
Python:
'''
it speaks something x times
a most basic skill.
also fun to make the chobit say what you want
'''


class APSay(Mutatable):
    def __init__(self, at: int, param: str) -> None:
        super().__init__()
        if (at > 10):
            at = 10
        self.at = at
        self.param = param

    def action(self, ear: str, skin: str, eye: str) -> str:
        '''TODO Auto-generated method stub'''
        axnStr = ""
        if (self.at > 0):
            if (ear.lower() != self.param.lower()):
                axnStr = self.param
                self.at -= 1
        return axnStr

    def failure(self, input: str) -> enumFail:
        """TODO Auto-generated method stub"""
        return enumFail.ok

    def completed(self) -> bool:
        """TODO Auto-generated method stub"""
        return self.at < 1

    def clone(self) -> AbsAlgPart:
        """TODO Auto-generated method stub"""
        return APSay(self.at, self.param)

I am fukurou slime and this is the APSay class python to swift translation

 
Top