Friday, December 16, 2022

Started creating in Python

I have started creating a game in Python.

This is still in progress of creation so this is not completed and this is still a demo stage. 

The following is the coding part. 

-------------------------------------------


# Imports

#Import requests for image uploading
import requests
from PIL import Image

# Import for saving data
import os
import numpy as np
import pandas as pd

# For status calculus
import calendar

# Month List
MONTH=[]
for i in range(3,13):
    MONTH.append(calendar.month_name[i])
for j in range(1,3):
    MONTH.append(calendar.month_name[j])
    
# Month List
#print(MONTH, len(MONTH))
MonthSeason=(0,0,0,1,1,1,2,2,2,3,3,3)
MonthDays=(31,30,31,30,31,31,30,31,30,31,31,28)

### --- Openning Script starts --- ###
Script01_openning="Welcome to the alternative world! You are living in a peaceful life with your wonderful daughter who is \n going to be 10 years old shortly after you are awake. \n You are obliged to bring her up until she turns to be 18 years old. \n\nYou are now living in a feudalist kingdom but its feudalist regime is actually on the verge of collapse as \n the waves of modernism are gradually approaching. A mysterious but plausible astrologist has predicted that \n this regime is estimated to end in 8 years. \n\nYour daughter seems to be dreaming to become a princess of \n this little pastoral kingdom while we expect her to live in a coming modern age and, if possible, \n to honourably lead this revolutionary movement! \n\nYou will need to send your daughter to a school to not only study for improving general characteristics \n but also train her various talents. \n But, please make sure not to bankrupt because these schools cost their tuition fee. \n Then, you will also need her to work for some part time jobs to balance the budget.  \n\nPlease also make sure to watch your daughter’s stress level which reduces her performance of increasing \n her abilities as well as her income earning. \n You will need her to take some rest and may occasionally go to vacation with her to relax. \n The positive influence of the vacation experience varies across different seasons. \n\nThis game is auto-saved while playing so that you may come back to this game with \n [1: Load to continue] from the point you ended last time unless the saved data file is lost or broken. \n\nEnjoy your life with your little princess! \n"
### --- Openning Script ends --- ###
# Default status
sts00 = "Daughters Name"
sts01=4500 # Money
sts02=0 #Stress Level
sts03=100 # Stamina
sts04=100 # Intelligence
sts05=100 # Willpower
sts06=100 # Pride
sts07=100 # Moral
sts08=100 # Elegance
sts09=100 # Amiability
sts10=100 # Art-Sense
sts11=100 # Charm
sts12=100 # Bravery
Daddy=1200 # Daddy's monthly income
YO=9 # Age at start
season=0
days=0
weeks=0
months=-1
x=0
week=0
SEASON=0
Talktime=0

# Game Starts!
print(" 0: New Game \n","1: Load to continue")
try:
    L = int(input('Enter 0 or 1'))
    if L==0:
        Load=0
        print("\n",Script01_openning)
        sts00 = input('What is the name of your little princess?')
    elif L==1:
        Load=1
        loadlist=[]
        Blk=""
        SD=(os.getcwd(),r'\PMsavedata.csv')
        SaveDirect=Blk.join(SD)
        df1=pd.read_csv(SaveDirect)
        var=0
        val=0
        for i in range(14):
            #var=df1['Variable'][i]
            val=df1['Value'][i]
            if i==0:
                loadlist.append(val)
                #print(loadlist[i],type(loadlist[i]))
                continue
            else: 
                val=float(val)
                loadlist.append(val)
                #print(loadlist[i],type(loadlist[i]))
                continue
        for i in range(14,20):
            #var=df1['Variable'][i]
            val=df1['Value'][i]
            val=int(val)
            loadlist.append(val)
            #print(loadlist[i],type(loadlist[i]))
            continue
            
        sts00=loadlist[0]
        sts01=loadlist[1]
        sts02=loadlist[2]
        sts03=loadlist[3]
        sts04=loadlist[4]
        sts05=loadlist[5]
        sts06=loadlist[6]
        sts07=loadlist[7]
        sts08=loadlist[8]
        sts09=loadlist[9]
        sts10=loadlist[10]
        sts11=loadlist[11]
        sts12=loadlist[12]
        Daddy=loadlist[13]
        YO=loadlist[14]-1
        season=loadlist[15]
        week=loadlist[16]
        days=loadlist[17]
        months=loadlist[18]
        SEASON=loadlist[19]

        #YO=YO-2
        
except ValueError:
    print('Please enter 0 or 1')

Status_Keys = ('Name', 'Age', 'Money', 'Stress', 'Stamina', 'Intelligence', 'Willpower', 'Pride', 'Moral', 'Elegance', 'Amiability', 'Art-Sense', 'Charm', 'Bravery')
Status_Values = (sts00, YO, sts01, sts02, sts03, sts04, sts05, sts06, sts07, sts08, sts09, sts10, sts11, sts12)


# Status Display
def Status():
    Status_Keys = ('Name', 'Age','Money', 'Stress', 'Stamina', 'Intelligence', 'Willpower', 'Pride', 'Moral', 'Elegance', 'Amiability', 'Art-Sense', 'Charm', 'Bravery')
    Status_Values = (sts00, YO, int(sts01), int(sts02), int(sts03), int(sts04), int(sts05), int(sts06), int(sts07), int(sts08), int(sts09), int(sts10), int(sts11), int(sts12))
    Status = dict(zip(Status_Keys,Status_Values))
    print(Status)

#Import requests for image uploading
import requests
from PIL import Image
def Character():
    if YO<12 and sts02>300:
        url = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2eot0py-yg7KmNwOFWtRPRh6E2GSeb1tY2mR85IZPG-QMUYabrwmJ3fQ_4QGIINlFDMQJoOaBUmrqlJ0X_f8rN3EnszggpAHKK-vGMgVQaGZPiauUqk_zfv01pk0gxrDHWu6fXB0OxgoCBbCb3ltQbitSVlgLNndppA90M6v-tebK88IM3w/s900/PM202212171.png"
        img_data = requests.get(url, stream = True).raw
        display(Image.open(img_data))
    elif YO>11 and sts02>300:
        url = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjryxUCv-9jzqm8spqwVaQ5C7onDMXOepnxeEZOxUYuXDSsHe6XKJTZXZQMzycT5txb-bEDuvyv15EY1VkkB8yKQguB4qMjeRUYdhfI9BFnZYWitO_hsOL2Ot3z_WmD5bPKyxI4-_1LjoY92qSTAXIQPFStN0GbfcxKS6kZ2r2ZyzRGW3wcdw/s900/PM202212241.png"
        img_data = requests.get(url, stream = True).raw
        display(Image.open(img_data))
    elif YO<14:
        url = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeKE_EzzcxiECeILEeBUICkZkYjr2YYgzGCnQOt2vJ2habuJ7VKHznBCbuyBx_5DQTqdgOjjd8fP1db7WgX3PunFwyaWs2Ys11fJoS4oEHGIUfTpUgqcbIfzb4f_m5hbJrXkrh7fagWp_SKp4kMscgCZVuY_Kdf0b_k7_KxCoJ_vhgVkKS0Q/s900/PM202212161.png"
        img_data = requests.get(url, stream = True).raw
        display(Image.open(img_data))
    elif YO>13:
        url = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl2pfMsbpmPmILGV0AY-otFv1n0FM2n7EMc5RkkzIQBhm1Sm3zEJIm0SU2Jd22o5wgZwJYK0Tu4Xr1zwlQHcL-soMGVmN5GoWOe2d0yyEYSc6MkkbOV3GNe517_mNIpZtTXy_PwX0t1zqPId6Vpi-mq8u_BTJgDTnmp7_IYx8-fIxTNxiWoQ/s900/PM202212172.png"
        img_data = requests.get(url, stream = True).raw
        display(Image.open(img_data))

#Images for actions
def ActionImages():
    ActImg11="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2k-jggOPz61f4QM2JlqHlp4KZK8r2rydi0Mj0tQGQ7D3KzGCFCNgHl2ln19gU8oKH-ovyq2ikAOMtfcWr1yoB_tIljJqri_lyC3XHIIinkzHUf4LaeAXJr7XCwvwZ-NXZW3tXpp0LE0aC9D6YZDjGT_wqldWVcTYd9uK6OKaXLU74JICDpw/s450/PM202212301.png"
    ActImg12="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1joZu7SmASz5lwmYtCzBPOgrp6JkftDxkGLrfBD8xy0Sq7ZLtAtxvKn2hKRV8joa1QOJrkeA-zX3-Cvs3kr82vf6Ohr5vVlfPiylpZnVpEf1CcmSjPsfLHhqUcm2feY7Dljb20OvxK6j3-N5riQikrQvN63NsTePoELix6l_V_BtRSa_PaQ/s450/PM202212302.png"
    ActImg13="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWqKi4Qq0CEwEn0L1Wob7ALnaCKTlq0vKYZ_4ogRnIp9IU47dtx2EJ76Ngu0PDnjhDl5JKK75Voq9_irOhWM4FwKuHPlKsWBSbwcyCbgItEYPyS7yOz6FSRUTtWRUsJs4oPJz57tyzHiMfOPdKmXx7wWmRle4ryoMDNsqkYJFy7tFs3YHIDA/s450/PM202212303.png"
    ActImg21="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWunTyWU3P0NCjbJDRg6JTKkVd9dQpKuV5iEANvcq62jaSZEgLX5v4YS_rdRG6PrKcKtA3Iz_yLFoWXkOx5nSwb0q2URwYyzUxtw44SaVESaKz6ooGRtdWgtE95HSYmuByp4M_u4IYXpdg6eDRjqKKfahGbMQz-3m0X6-9EGcUtJIUFgXoIQ/s450/PM202212304.png"
    ActImg22="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgMBnk41JHGDJzwJvqox68PoQnsO8Xg84_nSHSQEqimWcMkwETQzVf-RjD5_rAoBnKNo5MzjveSjtBeKuFRWGoFQGtHc8aUyZNbYnxs4v54K2E8wHkND0ugUuaPgpMxgxB_VCSXqrapOY5_wo47PTvJPYE3xm8WtsIPcZBPRQ7U5723bcHqg/s450/PM202212305.png"
    ActImg23="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrBFV_213Hq0oP4SCSqse9uLqT-735AHLUotnUPVNXp3iTicUXYrOnxbxf5x8XnnC1diCkKJjAvWDEyzJA4O-Eb03qbNO2GtWVjz3V6jY3vMlBzC42JDeQN-OumbF055Kb9m__7xPZ66tOHkr-y8601zkkhZqLZrTUKS6IjS8C7MEGmg9jAw/s450/PM202212311.png"
    ActImg24="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhks-OQH1-iWr3cNJdwRkGY_lZBDEp54DV-AVSGdWiFRBlgrzTYvEp6RIei4QHNSxz1WSVo5VWBteP84zGRAwhbWl_gRi6E27cGBX38WwYz1V1CI2j-S7d00Ytsi4WR3y2P_ovSPfP8FC_m_CzoD5NBSbBV7XgL6KzLOk9wGeBbcGyA4G4BEg/s450/PM202212312.png"
    ActImg25="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3-PT4goNWidKthcX_ES5wEpnMSGjx_bR_c2lliAqfVKdfApchRMqwqysm8OHSUVlA53QbmRC0d3ZDYs9QbElWw5H611kMb-5qCMeRi593jgAjuU4g4D0KWOhW0tZ8fVxrCwjm_kA3ifCgpADtbdi1lIQsoaGs-WJXtmuoJEF8iMAIpJGBFA/s450/PM202212313.png"
    ActImg41="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimBCr2xASoBs0YdgUt3oNeQOSmUkWivpAwj6eEUNi8DcJ4NV1u9ON0IH_X6FtgXwiUwtVX5Uki85m-Ok_cNXC2y88teX8vfa3JZ9xH4Bn6hwuInTwC-8ZHRuHHPP5EIpNuNj4noSGfKuFsGgWTQjfsvtCP_O7VvtZ-66eYuGqGn-kD2VMEAA/s450/PM202301011.png"
    ActImg42="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAoixiBmj3OQBrs9CaK3C4eBD-m-ZnK9k7aM2VBsH0WLo1ELdep42zA9rj5Ie8abmDRSOO-BpXDRlq45GtvoAMV1O2GkpxIkskyDK0hI4dO0PsCUdrWnTPOEJp2pzYV74ZLFUbXUVHWLA7gSNSfvUztbAZsTBvXTwW6VKSFshvniieqlc6Nw/s450/PM202301012.png"
    VactionImages430="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifSxUI41JmWtMvCAo1Mo2_w3Lv5MTUY6XGKt4SHKeoL5SH_KgjBrBzHXnfCeFUZcdcEjYuSxySqNOvelBjtlGbJSjb55LydWx3cWzZFNWFsVGd20hQOXwvH695R3G3u_qDurV3vOwygGCYBnI203klQNcV28hyvVTSK0deerqDnQSoVdy3lA/s600/PM202212281.png"
    VactionImages431="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh01fS93rWL0FiN-3ALQ6vRmy2ihqrlJwV5KQZ0g6mLIk4UNv5rANuHcFM5-zZXCWJecF-oSL7id3ixYf9Ho1U57gRyIXr7MkEqy5TaJOyn1sYaCb-NXd-MnvpKCCjjDGFUqFtzwoXWNIC7HPkp0EHk8xQiRjhhA9mwDH3NxNpFEGKtNS6LSQ/s600/PM202212291.png"
    VactionImages432="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwPCdyRFRriRSf11HeTDgKnR_tuEazqLQYkgSx30rx5XJDVxMaBaUiRVfwbLSsbbzX5lHuCCrr3_oitxT2eCXe553kbHZrYE6Q_gOuaR5toTDGKG7Qx0wQhWB8LXp8fvjQcyDOhdAJ32H8lxHfS-fmTK_SD08-gwH04pda3oiuaIWWTZV4UA/s600/PM202212282.png"
    VactionImages433="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNvx2i-n55sjAhY2FmJebX61zqBrHjJKrQLfDuj78QgQV0I9G0NXbSjG50AQTISugtfTQFqhStVCU5hsPcwjZisr7Ds0Oj6UEqlyWDDNBCdq7NgvMgQ1GSOwaRw6hZ4s2wQEtlyJjfp82-fhkeV9i6MGFtqMIWQIpooGJnGXiOlhCsmAUyyg/s600/PM202212283.png"
    VactionImages=[VactionImages430,VactionImages431,VactionImages432,VactionImages433]
    ActImg43=VactionImages[season]
    ActImgList=[0,0,0,0,0,0,0,0,0,0,0,
           ActImg11,ActImg12,ActImg13,0,0,0,0,0,0,0,
           ActImg21,ActImg22,ActImg23,ActImg24,ActImg25,0,0,0,0,0,
           0,0,0,0,0,0,0,0,0,0,
           ActImg41,ActImg42,ActImg43]
    ActImgList[x]
    
    url = ActImgList[x]
    img_data = requests.get(url, stream = True).raw
    display(Image.open(img_data))
        
        

# Tuple List Schools
sc01a=("School",0,0,3,6,5,6,12,9,3,5,0,0,"is studying at")
sc01d=("School",100.0,-5,0,0,0,0,0,0,0,0,0,0,"is studying at")
sc01p=("School",0,0,1,2,1,1,2,1,1,2,0,0,"is studying at")

sc02a=("Barrack",0,0,9,2,6,4,0,0,0,0,0,12,"is training at")
sc02d=("Barrack",50.0,-9,0,0,0,0,0,3,0,0,0,0,0,"is training at")
sc02p=("Barrack",0,0,3,1,2,0,0,0,0,0,0,4,0,"is training at")

sc03a=("Ballet",0,0,9,2,9,12,0,18,0,9,9,0,"is practising at")
sc03d=("Ballet",150.0,-6,0,0,0,0,0,0,0,0,0,0,0,"is practising at")
sc03p=("Ballet",0,0,1,1,1,1,0,2,0,2,2,0,0,"is practising at")

# Tuple List Jobs
jb01a=("Retail",100.0,0,2,3,5,0,0,0,0,0,8,0, "is wisely working at")
jb01d=("Retail",0,-10,0,0,0,1,2,2,4,0,0,0, "is wisely working at")
jb01p=("Retail",0,0,2,2,5,0,0,0,0,0,1,0, "is wisely working at")

jb02a=("Bar-Maid",150.0,0,3,0,3,0,0,0,0,0,9,0, "is charmingly working at")
jb02d=("Bar-Maid",0,-12,0,0,0,2,4,3,4,0,0,0, "is charmingly working at")
jb02p=("Bar-Maid",0,0,2,0,1,0,0,0,2,0,5,0, "is charmingly working at")

jb03a=("Bar-Bouncer",200.0,0,4,0,4,0,0,0,0,0,0,8, "keeps customers in fear of her at")
jb03d=("Bar-Bouncer",0,-12,0,0,0,0,5,5,5,1,4,0, "keeps customers in fear of her at")
jb03p=("Bar-Bouncer",0,0,2,0,1,0,0,0,0,0,0,7, "keeps customers in fear of her at")

jb04a=("Border-Patrol",90.0,0,4,0,6,4,6,0,0,0,0,6, "is on duty at")
jb04d=("Border-Patrol",0,-7,0,0,0,0,0,3,1,1,4,0, "is on duty at")
jb04p=("Border-Patrol",0,0,1,0,1,2,2,0,0,0,0,4, "is on duty at")

jb05a=("Babysitting",60.0,0,7,0,7,0,9,0,15,0,0,0, "is looking after infants and small-kids with her motherhood emotion at")
jb05d=("Babysitting",0,-10,0,0,0,2,0,3,0,0,0,0, "is looking after infants and small-kids with her motherhood emotion at")
jb05p=("Babysitting",0,0,2,0,2,0,2,0,4,0,0,0,0, "is looking after infants and small-kids with her motherhood emotion at")



# Tuple List Rest and Vacation


Vacation=['pops up to a beautiful meadow with a full of blooming flowers during her lively Spring',
         'enjoys sea-bathing at a tropical resourt beach beside during her exciting unforgettable Summer',
         'calms herself down under these tinting trees of a nostalgic country side during her melancholic Autumn',
         'is lost in tought for a chilling weather under a calm dark snowy sky during her Winter']
vacation=Vacation[season]

# Vacation Status Bonus 
VCT0=(0,0,0,2,2,2) # Spring Vacation Bonus
VCT1=(0,0,0,0,0,6) # Summer Vacation Bonus
VCT2=(0,0,3,0,3,0) # Autunn Vacation Bonus
VCT3=(1,1,1,1,1,1) # Winter Vacation Bonus
VCTsts=[sts03,sts05,sts08,sts09,sts10,sts11]
VCTcng=(VCT0,VCT1,VCT2,VCT3)
ifVCT=(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1)


# Rest at home
rst01a=("Home",0,0,0,0,0,0,0,0,9,0,0,0,"is just relaxing at")
rst01d=("Home",3.0,20,2,0,3,0,0,0,0,0,0,0,"is just relaxing at")
rst01p=("Home",0,0,0,0,0,0,0,0,0,0,0,0,"is just relaxing at")

# Going out
rst02a=("Going-Out",0,0,0,0,0,0,0,0,0,3,3,0,"has a little fun while")
rst02d=("Going-Out",20.0,30,0,0,3,0,3,0,2,0,0,0,0,"has a little fun while")
rst02p=("Going-Out",0,0,0,0,0,0,0,0,0,0,0,0,0,"has a little fun while")

# Go vacation
rst03a=("Vacation",0,0,0,0,0,0,0,0,0,0,0,0,"is on")
rst03d=("Vacation",300.0,70,0,0,0,0,0,0,0,0,0,0,0,vacation)
rst03p=("Vacation",0,0,0,0,0,0,0,0,0,0,0,0,0,vacation)



# Displaying her action for days in a week
def Action():
    Vacation=['pops up to a beautiful meadow with a full of blooming flowers during her lively Spring',
         'enjoys sea-bathing at a tropical resourt beach beside during her exciting unforgettable Summer',
         'calms herself down under these tinting trees of a nostalgic country side during her melancholic Autumn',
         'is lost in tought for a chilling weather under a calm dark snowy sky during her Winter']
    vacation=Vacation[season]
    Seasons1=['Spring','Summer','Autumn','Winter']
    Seasons2=['joyful','hot','calming','cold']
    print(sts00, schd_a[13], schd_a[0],"during the",Seasons2[season], "season of the", Seasons1[season], "time.")
    

### --- Ending Script starts --- ###
Script02_EndingForAll="This nostalgic but backward kingdom has faced its catastrophic ending with the newly emerging power of the republic overthrowing the monarchism under the slogans,’ Liberty, Equality, and Fraternity’ and ‘Of the people, By the people, For the people’. \n\nThe pastoral kingdom was peaceful and proud of its cultural heritage. However, the static lifestyle, the stagnated growth of living standard, and the unfair prestige of the monarchy and his peer aristocratic nobles caused the frustration of the fellow majority commoners. In particular, both enlightened intellectual and rebellious courageous individuals most notably led the revolution replacing the old regime with their new alternative. \n\n… tragic, …… how tragic of some believing in an everlasting dream of something having been seen as invincible! The dream of various…… Yes, dreams strongly remain in our mind but are indeed transient as same as the dream of the long-live regime of this little kingdom! … the great dream of one little girl is also the dream too.  \n\nMeanwhile, there was a rumour that a glorious passionate young lady leading the fellow people under this revolutionary conflict but who knows this goddess-like young lady was…  \n\n"
Script03_Ending_BeingLost="Many people welcomed this revolutionary movement altering the old regime whereas there were also those who have suffered. They were not only those having taken advantage of the old regime but also those who could not find the way of their life in the new era and those who were injured during this turmoil. You sustained a wound from the last turmoil as you have lost the means of living mentally and physically.", sts00, "seems to have disappeared from you while you could not show her the pathway to live in this world. Your negligence caused both her and yourself severe existential crisis. You may just hope she is living fine somewhere you will never know while suffering from your own existential threat too. "
Script04_Ending_Revolutionary="‘Rejoice …. Our glorious day has arrived!’ The lady ardently conducting the people for the revolution was actually", sts00,"!  Liberty is herself and she herself is liberty leading the people! She is grown up intelligently as well as courageously enough to understand such abstract concepts enabling individuals to imagine their alternative world view much more deserving themselves than the conventional world structure. Her charm also backed up her revolutionary charisma cheering the fellows up! Long live Mo.",sts00,"! Long live revolution!"
Script05_Ending_NobleLady="Your little princess, sts00, had a dream of becoming a real princess. But, becoming a real princess is no longer accomplishable because the monarchy is abolished. Yet, she is still your little princess for sure.  There is another gentleman who think as same as how you think of your sweet", sts00,"as. He is a rich successful man who is actually an enlightened noble but opposed to the last king and his regime. Under this post-revolution republic, he succeeded to stay in a power as a notable gentry successful in his business entrepreneur as well as being influential in the parliament. He proposed your daughter", sts00,"with a full of his passion and she happily accepted. She seems to actually live in a life of princess although this is not quite exactly the same."
Script06_Ending_UnderworldBoss="There is a proverb saying the enemy of your enemy is your friend. In this revolutionary civil war, this proverb also prevailed. Your daughter", sts00,"was leading the underworld faction of the revolution undermining the status-quo of the old regime. She could not be adapted to the mainstream community of her childhood. Instead, she was gradually adapted to the underworld, and then gradually distinguished herself with her strength and charisma. Even in the post-revolution republic, she still actively participated the underworld activities which cannot explicitly publicised. Nevertheless, her leadership as the organised faction was demanded in order to sustain order and stability of that world. Head and tail as well as light and shadow are inseparable to each other so that the latter world require the function too. "
Script07_Ending_RetailProfessional="Merchandise tends to thrive in any political system because it is simply required to sustain people’s daily life as well as enriching these powerful ones. Regardless of kingdom or republic, these wise merchants thrive to prop up their business. Your daughter", sts00,"works for the retail of her familiar business with her experience as well as her intelligence learnt through schooling and work experience in retail. She decided to pursue what she was already familiar with, and then she eventually became this professional.  "
Script08_Ending_HouseWife="While", sts00,"was turning to be an adulthood from a childhood, her country was in such a turmoil of the political transition from a kingdom to a republic. It is unimaginable to think how many times she wished for peace and stability in her new life. Someone may pick on her choice as mediocre, but we often forget how the ordinary life is precious. Protecting and developing a household is often challenging as much as doing for a country. Now,", sts00,"is a proud house-wise looking after her family members as well as her house itself."
Script09_Ending_Charming_Tavern_Master="Human-beings are naturally social so that their social interaction always thrives to exist regardless of kingdom or republic, or even on a verge of national crisis. Charming",sts00,"attracts many people to come to gather in her tavern. Her customers were cheered up her hospitable personality as well as her attractive appearance. Even after the revolution, the face of customers did not change much in such a public place in a downtown. Regardless of monarchism or republicanism, the majority people are just busy with their daily life which hardly changes despite the political transition. The lady",sts00,"contributed to the greatest sum of pleasures for the people having survived from the previously existing kingdom to the newly established republic.  "
### --- Ending Script ends --- ###

# Ending
def Ending():
    Ending=""
    EndRoll=""
    print(Script02_EndingForAll)
    if sts04>700 and sts06>600 and sts07>600 and sts11>500 and sts12>599:
        Ending="Revolutionary, the liberty leading the people"
        url = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNZrMqlUp0GLjCgoKQXtxPTj_Flm6BVW2hioCMdhEKMtlz5uHJ2qRQBZnFFoac6ngJjZZVQ8dTtoQ1LOLl9xv6XjZBQUzw0LL72EE3SIMR0o_FQ5EmSduWWeOlICz7t7Eq5TzyluAhuECdvlNYTKFmeTdnEJ6Nv73jnvm9ipdL8sr_LTfA_A/s900/PM202212181.png"
        img_data = requests.get(url, stream = True).raw
        display(Image.open(img_data))
        EndRoll=Script04_Ending_Revolutionary
    elif sts04>600 and sts06>500 and sts07>400 and sts08>590 and sts09>490 and sts10>790 and sts11>900:
        Ending="Noble-Lady"
        url = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHEWu6FMCT0oJnxrRB0D7flkSAQ4lnQKQBLYJ4CpObBhm6qtUnF-aPB6U-bi8B4jvEYFXMuMv1BvHt63qEyqfCF5BNVmiep1Ds2LDWTSRuH1K98eMqxjmHgweUMwxtHnujK_FVZuckQYHuMpyFc5HQix68CSWRYeCRR8JYCuVhazhE82ix6A/s900/PM202212251.png"
        img_data = requests.get(url, stream = True).raw
        display(Image.open(img_data))
        EndRoll=Script05_Ending_NobleLady
    elif sts04>500 and sts07<600 and sts12>700:
        Ending="Underworld-Boss"
        url = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjgoPdpzYABTSwzc-O-3TPv6SzvZpgu20c24feIQ2zXJfK5ojWUOPRW_U6K1lpUtRbCjM7CBFB-JRQWcVV-tiszeyTaryx9Zh5zXUziGNiif0UO4qKGsTXyRDUppUdvqlCNqmyYgloOWA2UOGfmJyWI1szxjRXHZJBJKtB9vYKQSDdYu3_mA/s900/PM202212232.png"
        img_data = requests.get(url, stream = True).raw
        display(Image.open(img_data))
        EndRoll=Script06_Ending_UnderworldBoss
    elif sts07>490 and sts09>490:
        Ending="House-Wife"
        url = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVApIennZ6xXfxMB32BMK_9kl1_qS0bNU_rWlAFzjfLu1V82OF4cbo6ZSLGaKEUosb2eHzxvN4dtqjDu49SlMbXwlljL2risGVQCdf9yQF4CWdv3Ucq_brjvMuLJPJPYrmumJBxcS7EhDLHs44bt6hOP4aR87nnHlLD5EW-_qaTFic7vlokg/s900/PM202212231.png"
        img_data = requests.get(url, stream = True).raw
        display(Image.open(img_data))
        EndRoll=Script08_Ending_HouseWife
    elif sts04>690:
        Ending="Retail-Professional"
        url = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWunTyWU3P0NCjbJDRg6JTKkVd9dQpKuV5iEANvcq62jaSZEgLX5v4YS_rdRG6PrKcKtA3Iz_yLFoWXkOx5nSwb0q2URwYyzUxtw44SaVESaKz6ooGRtdWgtE95HSYmuByp4M_u4IYXpdg6eDRjqKKfahGbMQz-3m0X6-9EGcUtJIUFgXoIQ/s450/PM202212304.png"
        img_data = requests.get(url, stream = True).raw
        display(Image.open(img_data))
        EndRoll=Script07_Ending_RetailProfessional
    elif sts11>700:
        Ending="Charming-Tavern-Master"
        url = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgMBnk41JHGDJzwJvqox68PoQnsO8Xg84_nSHSQEqimWcMkwETQzVf-RjD5_rAoBnKNo5MzjveSjtBeKuFRWGoFQGtHc8aUyZNbYnxs4v54K2E8wHkND0ugUuaPgpMxgxB_VCSXqrapOY5_wo47PTvJPYE3xm8WtsIPcZBPRQ7U5723bcHqg/s450/PM202212305.png"
        img_data = requests.get(url, stream = True).raw
        display(Image.open(img_data))  
        EndRoll=Script09_Ending_Charming_Tavern_Master
    else:
        Ending="Lost while revolution..."
        EndRoll=Script03_Ending_BeingLost
    print("Through this revolutionary turmoil", sts00, "has become", Ending,"! \n")
    print(EndRoll)
     
        

### ------  Menu Frame ------ ###
Schedule_Selection_a=(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                      sc01a, sc02a, sc03a, 0, 0, 0, 0, 0, 0, 0,
                      jb01a, jb02a, jb03a, jb04a, jb05a, 0, 0, 0, 0, 0,
                      0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                      rst01a, rst02a, rst03a, 0, 0, 0, 0, 0, 0, 0
                     )
Schedule_Selection_d=(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                      sc01d, sc02d, sc03d, 0, 0, 0, 0, 0, 0, 0,
                      jb01d, jb02d, jb03d, jb04d, jb05d, 0, 0, 0, 0, 0,
                      0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                      rst01d, rst02d, rst03d, 0, 0, 0, 0, 0, 0, 0
                     )
Schedule_Selection_p=(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                      sc01p, sc02p, sc03p, 0, 0, 0, 0, 0, 0, 0,
                      jb01p, jb02p, jb03p, jb04p, jb05p, 0, 0, 0, 0, 0,
                      0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                      rst01p, rst02p, rst03p, 0, 0, 0, 0, 0, 0, 0
                     )
Menu_Input=[]
Menu_Action=[]
Menu_Daily_Fee=[]
Menu_Daily_Rate=[]
Requirement=[]
Menu_Reqs=[]
for i in range(51):
    if Schedule_Selection_a[i]==0:
        continue
    else:
        for j in range(2,13):
            if Schedule_Selection_p[i][j]<2:
                continue
            else:
                Requirement.append(Status_Keys[j+1])
            
        #print(Schedule_Selection_a[i][0], Schedule_Selection_d[i][1],Schedule_Selection_a[i][1],Requirement)
    Menu_Input.append(i)
    Menu_Action.append(Schedule_Selection_a[i][0])
    Menu_Daily_Fee.append(Schedule_Selection_d[i][1])
    Menu_Daily_Rate.append(Schedule_Selection_a[i][1])
    Menu_Reqs.append(Requirement)
    Requirement=[]
#print(Menu_Input,"\n",Menu_Action,"\n",Menu_Daily_Fee,"\n",Menu_Daily_Rate,"\n",Menu_Reqs)
Menu_dict={'Key Input':Menu_Input,'Action':Menu_Action,'Fee':Menu_Daily_Fee,'Wage':Menu_Daily_Rate,'Requirements':Menu_Reqs,}
Menu = pd.DataFrame(Menu_dict)
Menu
### ------ End of Menu Frame ------ ###


x=0

Status_Keys = ('Name', 'Money', 'Stress', 'Stamina', 'Intelligence', 'Willpower', 'Pride', 'Moral', 'Elegance', 'Amiability', 'Art-Sense', 'Charm', 'Bravery')
Status_Values = (sts00, sts01, sts02, sts03, sts04, sts05, sts06, sts07, sts08, sts09, sts10, sts11, sts12)


# Mainframe without making it the function
xlist=[1,2,11,12,13,21,22,23,24,25,41,42,43,99]
Seasons1=['Spring','Summer','Autumn','Winter']
Seasons2=['joyful','hot','calming','cold']

for year in range(8):  
    YO=YO+1
    print('-+--+--+--+--+--+--+--+--+--+--+--+--+-- \n')
    print("Happy",YO, "birthday my dear", sts00,"! \n")
    print('-+--+--+--+--+--+--+--+--+--+--+--+--+--')
    if x==99 or sts01<0:
        print("Game ends.")
        break
    elif YO>17:
        Ending()
        break
    else:             
        for month in range(12): 
            if Load==1 and months!=month:
                #print("month:", month, "Month:", MONTH[months], months)
                continue
            else:
                Load=0
                #months=months+1
                #print("season:",season, "SEASON:",SEASON, "Month:", MONTH[months], months)
            
                months=month
                season=MonthSeason[month]
                if x==99 or sts01<0 or months>11:
                    break
                elif YO>17:
                    break
                #months=months+1  
                print("New month", MONTH[months], "starts!")
                
                # Auto-Save
                savelist_variable=['sts00','sts01','sts02','sts03','sts04','sts05','sts06','sts07','sts08','sts09','sts10','sts11','sts12','Daddy','YO','season','week','days','months','SEASON']                    
                savelist_value=[sts00,sts01,sts02,sts03,sts04,sts05,sts06,sts07,sts08,sts09,sts10,sts11,sts12,Daddy,YO,season,week,days,months,SEASON]
                Save_dict={'Variable':savelist_variable,'Value':savelist_value}
                df = pd.DataFrame(Save_dict)
                Blk=""
                SD=(os.getcwd(),r'\PMsavedata.csv')
                SaveDirect=Blk.join(SD)
                os.makedirs(os.getcwd(), exist_ok=True)  
                df.to_csv(SaveDirect)   
                print("Data Sevad!")
                    
                for week in range(4):
                    Character()
                    weeks=weeks+1
                    print("New", weeks,"th week starts!")
                    if x==99:
                        break
                    elif sts01<0:
                        print("You are bankrupt! Game over!")
                        break
                    elif sts02<0:
                            sts02=0
                            weeks=weeks-1
                            continue

                    # Command Input
                    print("  1: Show Status \n", " 2: Talk to",sts00,"(If NLTK is downloaed!) \n","99: Game End")
                    display(Menu) # Call Panda-Dataframe Menu
                    try:
                        x = int(input('What is this week schedule for?'))
                        #print(x, type(x))
                        if x == 99 or YO>17:
                            break
                        elif x==194:
                            YO=YO+1
                            continue
                        elif x==1:
                            Status()
                            weeks=weeks-1
                            continue

                        elif x==2:
                        # Only available to activate if you have installed NLTK!
                            import nltk
                            from nltk.sentiment.vader import SentimentIntensityAnalyzer
                            analyser = SentimentIntensityAnalyzer()
                            import math
                            while Talktime==0:
                                Talk=input('What you would like to say?')
                                print('-+--+--+--+--+--+--+--+--+--+--+--+--+--')
                                tlknd_sentences=nltk.sent_tokenize(Talk)
                                tlknd_words=nltk.word_tokenize(Talk)
                                
                                sentences_neg_count=0
                                sentences_neu_count=0
                                sentences_pos_count=0
                                sentences_neg_score=0
                                sentences_pos_score=0
                                sentences_score=0
                                for i in range(len(tlknd_sentences)):
                                    score_sentences = analyser.polarity_scores(tlknd_sentences[i])
                                    sentences_neu_count+=[analyser.polarity_scores(tlknd_sentences[i])['neu']][0]
                                    sentences_neg_count+=[analyser.polarity_scores(tlknd_sentences[i])['neg']][0]
                                    sentences_neg_score+=[analyser.polarity_scores(tlknd_sentences[i])['neg']][0]*[analyser.polarity_scores(tlknd_sentences[i])['compound']][0]
                                    sentences_pos_count+=[analyser.polarity_scores(tlknd_sentences[i])['pos']][0]
                                    sentences_pos_score+=[analyser.polarity_scores(tlknd_sentences[i])['pos']][0]*[analyser.polarity_scores(tlknd_sentences[i])['compound']][0]
                                    #display(tlknd_sentences[i], analyser.polarity_scores(tlknd_sentences[i]))
                                if sentences_neu_count<sentences_neg_count or sentences_neu_count<sentences_pos_count:
                                    sentences_score=0
                                elif sentences_pos_count>sentences_neg_count:
                                    sentences_score=sentences_pos_score
                                elif sentences_pos_count<sentences_neg_count:
                                    sentences_score=sentences_neg_score    
                                else: 
                                    sentences_score=0
                                #print(sentences_score, "  #Neg:",sentences_neg_count,"  #Neu",sentences_neu_count,"  #Pos",sentences_pos_count,)
                                words_neg_count=0
                                words_neu_count=0
                                words_pos_count=0
                                words_neg_score=0
                                words_pos_score=0
                                words_score=0
                                for i in range(len(tlknd_words)):
                                    score_words = analyser.polarity_scores(tlknd_words[i])
                                    words_neu_count+=[analyser.polarity_scores(tlknd_words[i])['neu']][0]
                                    words_neg_count+=[analyser.polarity_scores(tlknd_words[i])['neg']][0]
                                    words_neg_score+=[analyser.polarity_scores(tlknd_words[i])['neg']][0]*[analyser.polarity_scores(tlknd_words[i])['compound']][0]
                                    words_pos_count+=[analyser.polarity_scores(tlknd_words[i])['pos']][0]
                                    words_pos_score+=[analyser.polarity_scores(tlknd_words[i])['pos']][0]*[analyser.polarity_scores(tlknd_words[i])['compound']][0]
                                    #display(tlknd_words[i], analyser.polarity_scores(tlknd_words[i]))
                                if words_neu_count<words_neg_count or words_neu_count<words_pos_count:
                                    words_score=0
                                elif words_pos_count>words_neg_count:
                                    words_score=words_pos_score
                                elif words_pos_count<words_neg_count:
                                    words_score=words_neg_score    
                                else: 
                                    words_score=0
                                #print(words_score, "  #Neg:",words_neg_count,"  #Neu",words_neu_count,"  #Pos",words_pos_count,)
                                TotExp=(math.exp(sentences_score)*0.6)*((math.exp(words_score)*2))
                                TotalScore=math.log(TotExp)
                                print("Your Sentiment Score:",int(TotalScore))
                                print('-+--+--+--+--+--+--+--+--+--+--+--+--+--')
                                Talktime+=1
                                if TotalScore>3:
                                    print(" \n\n",sts00,'says "....Wow daddy, thanks! I am so touched. xxx"\n\n')
                                    print('-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--')
                                    sts02=sts02-90 #Stress Level
                                    sts05=sts05+10 # Willpower
                                    sts06=sts06+60 # Pride
                                    sts07=sts07+20 # Moral
                                    sts08=sts08+20 # Elegance
                                    sts09=sts09+20 # Amiability
                                    Status()
                                elif TotalScore>1: 
                                    print(" \n\n",sts00,'says "Thank you, daddy. x "\n\n')
                                    print('-+--+--+--+--+--+--+--+--+--+--+--+--+--')
                                    sts02=sts02-60 #Stress Level
                                    sts09=sts09+10 # Amiability
                                    Status()
                                elif TotalScore<-2:
                                    print(" \n\n",sts00,'says ".... I am so sorry. Please forgive me, daddy..."\n\n')
                                    print('-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--')
                                    sts02=sts02+60 #Stress Level
                                    sts06=sts06-30 # Pride
                                    sts07=sts07+120 # Moral
                                    sts08=sts08+120 # Elegance
                                    Status()
                                elif TotalScore<0:
                                    print(" \n\n",sts00,'says "Go away."\n\n')
                                    print('-+--+--+--+--+--+--+--+--')
                                    sts02=sts02+60 #Stress Level
                                    sts06=sts06-30 # Pride
                                    Status()
                                else:
                                    print(" \n\n",sts00,'says "Oh ok."\n\n')
                            print('-+--+--+--+--+--+--+--+--+--+--+--+--')
                            print(sts00,'says "have a nice day, daddy!"')
                            print('-+--+--+--+--+--+--+--+--+--+--+--+--')
                        # Above: Only available to activate if you have installed NLTK!
                            weeks=weeks-1
                            continue

                        elif x in xlist:           
                            for day in range(1,8):

                                schd_a = Schedule_Selection_a[x]
                                schd_d = Schedule_Selection_d[x]
                                schd_p = Schedule_Selection_p[x]
                                
                                # Growth Influencing Plus Metre before daily growth
                                PLS=0
                                pls=0
                                #sts_list
                                sts_list=[sts00,sts01,sts02,sts03,sts04,sts05,sts06,sts07,sts08,sts09,sts10,sts11,sts12]
                                for p in range(3,13):
                                    #print(Status_Keys[p],Schedule_Selection_p[x][p],sts_list[p]/100) # Delete in the mainframe
                                    PLS=PLS+Schedule_Selection_p[x][p]*sts_list[p]/100
                                    #print(PLS)
                                    pls=pow(PLS/10,0.5) ####
                                #print("pls:", pls/100)
                                
                                
                                # Daily Status Growth
                                sts01= sts01+ pow(schd_a[1],1+pls/100)*((pow(2,1-sts02/100))/2) -schd_d[1]
                                sts02= sts02+ pow(schd_a[2],1+pls/100)*((pow(2,1-sts02/100))/2) -schd_d[2]
                                sts03= sts03+ 0.5*pow(schd_a[3],1+pls/100)*((pow(2,1-sts02/100))/2) -schd_d[3]
                                sts04= sts04+ 0.5*pow(schd_a[4],1+pls/100)*((pow(2,1-sts02/100))/2) -schd_d[4]
                                sts05= sts05+ 0.5*pow(schd_a[5],1+pls/100)*((pow(2,1-sts02/100))/2) -schd_d[5]
                                sts06= sts06+ 0.5*pow(schd_a[6],1+pls/100)*((pow(2,1-sts02/100))/2) -schd_d[6]
                                sts07= sts07+ 0.5*pow(schd_a[7],1+pls/100)*((pow(2,1-sts02/100))/2) -schd_d[7]
                                sts08= sts08+ 0.5*pow(schd_a[8],1+pls/100)*((pow(2,1-sts02/100))/2) -schd_d[8]
                                sts09= sts09+ 0.5*pow(schd_a[9],1+pls/100)*((pow(2,1-sts02/100))/2) -schd_d[9]
                                sts10= sts10+ 0.5*pow(schd_a[10],1+pls/100)*((pow(2,1-sts02/100))/2) -schd_d[10]
                                sts11= sts11+ 0.5*pow(schd_a[11],1+pls/100)*((pow(2,1-sts02/100))/2) -schd_d[11]
                                sts12= sts12+ 0.5*pow(schd_a[12],1+pls/100)*((pow(2,1-sts02/100))/2) -schd_d[12]
                                Action()
                                ### --- Vacation only effect starts --- ###
                                Vacation=('She pops up to a beautiful meadow with a full of blooming flowers during her lively Spring',
                                          'She enjoys sea-bathing at a tropical resourt beach beside during her exciting unforgettable Summer',
                                          'She calms herself down under these tinting trees of a nostalgic country side during her melancholic Autumn',
                                          'She is lost in tought for a chilling weather under a calm dark snowy sky during her Winter')
                                vacation=Vacation[season]
                                VacationMessage=('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',
                                                 '','',vacation)
                                print(VacationMessage[x])
                                VCTsts=[sts03,sts05,sts08,sts09,sts10,sts11]
                                for i in range(len(VCTsts)):
                                    VCTsts[i]=VCTsts[i]+VCTcng[season][i]*ifVCT[x]*((pow(2,1-sts02/100))/2)
                                    #print(VCTsts)
                                    sts03=VCTsts[0]
                                    sts05=VCTsts[1]
                                    sts08=VCTsts[2]
                                    sts09=VCTsts[3]
                                    sts10=VCTsts[4]
                                    sts11=VCTsts[5]
                                ### --- Vacation only effect ends --- ###
                                ActionImages()
                                Status()
                                days=days+1
                                Talktime=0
                                print("The end of day",day, "in the week",weeks,",",
                                        days, "th day of", MONTH[months],
                                        "in the season of", Seasons1[season], ". \n")
                                if days>=MonthDays[months]:
                                    if months==11:
                                        months=0
                                        print("The end of month. Today is daddy's (your) payday!")
                                        sts01=sts01+Daddy
                                        Status()
                                        days=0
                                        weeks=0
                                        break
                                    else:
                                        months=months+1
                                        print("The end of month. Today is daddy's (your) payday!")
                                        sts01=sts01+Daddy
                                        Status()
                                        days=0
                                        weeks=0
                                        break
                                elif YO>17:
                                    break
                                else:
                                    continue
                                continue
                        else:
                            print("Not in the schedule menu! Please try again.")
                            continue
                    except ValueError:
                        print('Please enter an integer.')


------------------------------------------- 

The end of coding part.

The following images are the very first character design.  


 



 











 
 


 


 
 

 



















PS

How to play "Liberty's Daughter 育成ゲーム" with Colaboratory


Saturday, October 22, 2022

My Python in practice 20221022

My Python in practice 20221022

My wee Python programming to simulate Money Supply ⇒ Interest Rate ⇒ Investment volume. I am practising with applying my Python lesson to some sort of simulation modelling instead of just memorising it!

def Y_Inv(MS,Y):
    r_MS=pow(MS/10,-1.05)
    return pow(Y,-1*(r_MS))

for MS in range(1,100):
    print(Y_Inv(MS,100))

 

The followings are the breakdowns: 

 

# Liquidity(Money Supply) where Money Supply is i in range ():
def r_MS(MS):
    return pow(MS/10,-1.05)

for i in range(1,100):
    print(r_MS(i))



# Liquidity(Money Supply) where Interest Rate on Money Supply = Liquidity is i in range () WITH GENERATOR:

def r_MS(MS):
    yield pow(MS/10,-1.05)

for i in range(1,100,10):
    print(r_MS(i))

next(r_MS(i))


# Lambda function example of Interest Rate on Money Supply and Income of Investment on Interest Rate (on Money Supply = Liquidity) and Income fixed:

r_MS= lambda MS: pow(MS/10,-1.05)
Y_inv = lambda MS,Y : pow(Y,-1*(r_MS(MS)/10))

print("Interest Rate by Money Supply is", r_MS(100))
print("Income by investment is", Y_inv(100,100))



# Higher function of Income of Investment on the Interest Rate on Money Supply = Liquidity:

def Y_Inv(MS,Y):
    r_MS=pow(MS/10,-1.05)
    return pow(Y,-1*(r_MS))

Y_Inv(100,100)



# Income of Investment on the Interest Rate on Money Supply = Liquidity

def Y_Inv(MS,Y):
    r_MS=pow(MS/10,-1.05)
    return pow(Y,-1*(r_MS))

for MS in range(1,100):
    print(Y_Inv(MS,100))

 

# Income of Investment on the Interest Rate on Money Supply = Liquidity WITH GENERATOR:

def Y_Inv(MS,Y):
    r_MS=pow(MS/10,-1.05)
    yield pow(Y,-1*(r_MS))
    
for MS in range(1,100,10):
    x = (Y_Inv(MS,100))
    print(x)

next(x)


My Python in practice 20221023

I practised Python dictionary function with the character-status of Romancing Saga 3 characters (See My Python in practice 20221023)

 

 

 

 

 

 

 

 

 

 

 

Wednesday, August 31, 2022

Libertarian: The Most Radical Progressive!

 

Libertarian is often seen as either an ally with conservatives (natural law) or a revolutionary like Marxism. However, Libertarian is close to neither of them especially by means of its metaphysical perspective. Let’s evaluate Libertarian and its contrasts.

Libertarian is a fundamentally metaphysical radical located at the edge of the metaphysical spectrum asserting the complete opposition from the Determinist counterpart. Conservatives usually regard of the unchangeable nature of humans and their world unlike Libertarian believing in the ultimate power of individuals free will transforming the world. Therefore, conservatives tend to lean relatively more towards Determinism than Libertarian radically being sceptical about Determinist metaphysics.

Both Marxist materialism and Libertarian are indeed progressives against conservatives. On the other hand, Libertarian instead insists on much more radical progressivism than Marxism notably by means of the metaphysics. Libertarians do not take account of Marxian materialist perspective because the will of individuals is free from the material constraints while their will is more influential over the world shape than the materialist assumption.

Marxism and the other types of materialism assume that material conditions and physical surrounding environment of individuals influence both the fate of human-individuals as well as their will. Therefore, it describes that it is the historical inevitability to provoke a revolutionary movement when a large majority group of individuals is marginalised from the world structure to expect the change. Marxism focuses on the group of individuals sharing the same materialist interest rather than each individual’s own unique imagination with their free will. Thus, Marxist materialism is still relatively more towards Determinism with its emphasis on the fate for individuals awaiting the collectively organised reformation/revolution.

Libertarian does not count on a possibility of the world transformation as the fated historical inevitability like Marxism. It assumes that individuals are always free to change themselves and the world whenever they want. Marxism and the other materialists underestimate the power of each individual for its possibility to transform the world alone. By contrast, Libertarian expects each individual alone has her/his own invincible power of transforming the world.

Libertarian is the resemblance to spiritualism rather than materialism despite its intense secular characteristic defying superstition and moral cohesion. It can be called secular-spiritualism regarding highly of individuality of each unique individual. It is identical to Epicurean of the ancient Greek philosophy stating the world reality is the mirror reflecting individuals’ mindset. It is also close to Buddhism stating various unique universes exist per the number of individuals existing in this world.

There is no such a thing as the determined world because there is an unlimited number of the parallel worlds existing as the interactions of both material beings and the invincible free will of each autonomous individual prevails to exist! The reason why many individuals still feel like being prisoned in the limitation of this terrestrial world is that they are still bound to the authoritarian indoctrination by the ruling class oppressors.

The imagination power of majority individuals is still not strong enough to drastically transform their world environment and their life. Nevertheless, this imagination power strength can be trained to gradually grow enough to be close to the saints having existed in the world spiritual history. Do not surrender to the inevitability mythology indoctrinated by conservatives! Do not underestimate each autonomous individual which is way stronger than the cohesive union of individuals merely stimulated by the material conditions and motivated by the collective political agitation of Marxism!

Daoism well explains how the world is turning up to be. In particular, from now on, the material prosperity represented as 陽 (Yang, the light element) is decaying as the reaction towards its intensity up to recently. Then, 陰 (Ying, the shadow element) representing spirituality and humbleness is being intensified in the entire world from now on.

The influence of Marxism with the heavy emphasis on the perfectionist goodness of the materialistic transformation is characterised by the Yang (Light) element. Instead, the humble attitude based on the tolerance towards material stagnation such as encouraging the humble living condition under the natural harmony, characterised by the Ying element, will be recommended as the virtuous wisdom to live off.

Under such a world with the stronger Ying elemental characteristic and quality, Libertarian spiritualism will help individuals to live off. Both Daoism and Libertarian regard highly of the natural harmony under the free flow of things and lives with their voluntary will not constraint by any hypocritical indoctrination. Instead of the perfectionist intervention like Marxism, they assert reinforcing the power of each autonomous individual’s will and imagination to naturally adopt themselves to the given living environment to thrive there.

At the same time, the ruling class oppressors of the status-quo having exploited the rest will eventually face the punishment by means of the flow of this world transformation. Its Ying characteristic punishes those who cannot neither accept nor be satisfied with the humble lifestyle. The voluntary community cooperation of individuals will be emphasised in the near future so that those who cannot comply with its spontaneous rule will be expelled away. Libertarians can be compatible with this communitarian sense even with its intense individualism: Its communitarian solidarity is based on individuals’ voluntary will instead of Marxian style cohesive enforcement agitating with the hypothetical perfectionism.

In conclusion, Libertarian can be the most sanely deviant political philosophy having existed in history. It can be adaptable to the new age spiritualism defining the world composed of the unlimited parallel worlds with which are popular especially in the internet activities nowadays.

Tuesday, August 30, 2022

Low-tech firms should rather adopt the public cloud!

Many small and medium companies as well as public institutes of the local authorities tend to be reluctant to adopt an advanced information technological (IT) apparatus such as the public cloud service due to their cost concern as well as their conservative characteristics. They tend to assume that they will not take an advantage of the large scale of economies offered by the public cloud service. However, these firms are actually those which will take a considerably high benefit of using the public cloud service. It is explained with the example of using Amazon Web Service (AWS).
 
The first issue is the version update including the cyber security. The average cost of the version update is heavier for smaller firms so that it is actually more cost efficient to rely on one unified provider. AWS updates their versions of the physical machines as well as the cyber security measures adapted to the latest requirements for the most recent environment for their entire global network. Furthermore, some of the security package, such as AWS Shield, come as the standard package.

 
The second issue is the maintenance of the physical apparatus in their on-premises environment. These small companies and relatively IT illiterate local authorities tend to often neglect properly looking after their on-premises environment and maintaining its durability. Moreover, they tend to be more prone to natural disasters striking their place. All in all, they had rather better locate their electrical data while implementing their cross regional redundancy of the entire database in case of a disaster and a cyber security threat.
 
Regarding their data management, AWS offers various types of database (DB) depending on conditions and usages. Amazon Dynamo DB handles non-structured data with a large volume so that electrifying the information is flexible to query and store. Amazon Aurora is autoscalable across the multi-regions so that the data redundancy is guaranteed in case of various disasters and the access overflow undermining the data-handling capability.
 
If they are worried about moving their data at once, AWS offers the data migration services such as AWS Snowball and AWS Snowmobile (called AWS Snow-family overall). These offer the option of outsourcing the entire data migration from their on-premises to AWS server network. Perhaps, these small and medium companies as well as the local authorities had better migrate the entire data and maybe the entire IT configuration to the public cloud in order to cut their expenditure for their IT staff as well as their physical space and apparatus.
 
There are still many individuals worried about the privacy and the countermeasure against the data leakage. Nevertheless, storing data in their nondurable vulnerable on-premises environment seems to be far riskier than outsourcing the database and the storage to the public cloud vendor. In addition, the scalablity and the redundancy across the regions enable to flexibly link and query the data across various places at any time available. Therefore, it is also expected to improve their administrative efficiency too.
 
 

Monday, August 29, 2022

Plato vs Aristotle

There is a famous Raphael’s painting showing the contrast between Plato and Aristotle by means of their philosophical differences on the centre in the ancient Athenian academia. Plato pointing out above indicates his idealism whilst Aristotle pointing out below indicates his naturalism (disagreeing to describe his philosophy as realism). This passionate academic arena is indeed the place to visit if there were a time-machine.

The significant distinction between Plato and Aristotle is their focus on the human nature; Plato believed in something more transcendent to the human nature whereas Aristotle puts emphasis on the inevitable unchangeable human nature. Plato manifested the single ideal state model (Stratified guardian/spectator autocracy) meanwhile Aristotle described various unique state models adaptable to each unique nature of geo-politics and ethnicity (Monarchy/Dictatorship, Aristocracy/Oligarchy, and (Direct) Democracy.)

Plato’s Predecessor Socrates was the first remarkable idealist insisting on the moral universalism which all human individuals should aspire to follow to accomplish a unified ideal objective transcending to the human nature forming their living environment. By contrast, Aristotle admitted there is an inevitable but productive human nature underlining to form their characteristics and adaptation to the changing living environment. Plato claimed for the better alternative whereas Aristotle suggested for various unique states for each varying environmental condition.

This conflict model of the philosophical perspectives has been a universally discussed topic all over the world since then. Even in the Eastern Asia, there is a philosophical contract resemblance to this Western counterpart: Confucian is the idealist pursuing for the universal transcendental objective like Plato whilst Daoism describing various unique forms naturally adapted to each situation. In the modern era, even though the philosophical perspectives offer far more complex theory with a bigger picture, the same conflicting concept still remains.

In the modern era, there are many derivations partially adopting both Platonian and Aristotelian concepts. Thomas Hobbes based his theory on the moral relativism while adopting the Platonian-like stratified autocratic order providing the strong unity of all the individuals. Jeremy Bentham insisted on the moral universalism of pursuing the unified objective although its principle is derived from the conventional human nature instead of the transcendental alternative while supporting a more democratic state.

Kant achieved in providing the far more complex theory of its moral universalism than Plato. Considering Plato only discussed something A and something not-A, Kant clarified something defining and verifying the existence of both A and not-A as a priori which is resemblance to mathematical axiom. Then, instead of the substantial principle such as the guardian autocracy, he claimed for the abstract principle for something human individuals are supposed to obey. Then, regardless of any political form of states existing depending on each unique environmental condition, human individuals are supposed or encouraged at least to obey the universal abstract ethical principle as their maxim for accomplishing their ethically ideal goal little by little with try and error.

Kantian philosophy is rather called Conceptualism distinguished from Platonic idealism due to its flexibility as well as its complexity. Kant admitted some real substantial world obstacles disrupting individuals to establish an ideal state although he suggested they should make their best effort to accomplish their ideal transcendental to their conventional natural quality. Friedrich Hegel modified Kantian philosophy by adopting Platonic idealist concept. Hegel affirmed that human individuals are gradually evolving to establish their heavenly ideal state by referring to their ethical maxim.

David Hume can be seen as the first remarkable philosopher challenging against the aforementioned Socratic successors. Hume took over Hobbesian moral relativist perspectives while defying to manifest one particular form of state like Hobbes. Hume’s philosophy is definitely opposing to Plato by means of being sceptical about both the morality which human individuals can hypothetically define to impose upon themselves and the existence of something transcendental to the human nature without experiencing to explicitly prove their existence in real.

Kant started inventing his philosophy as the counterpart argument against Hume’s Experimentalist philosophical theory. Hume’s theory has influenced Benthamite Utilitarian philosophy by means of its emphasis on the naturalism and by means of its scepticism about the non-natural transcendental moral principle although Hume and Bentham disagreed with each other by means of their moral theory. It has also seemingly influenced the postmodern philosophies which are very similar to Hume’s perspective on the moral principle and the human nature because both support the moral relatives and the human naturalism.

In the postmodern era, there were many postmodernist philosophers introducing their own version of the pre-Socratic concepts detaching philosophies from both the idealism and the moral universalism. They often defied the universal nature of human individuals which Aristotle claimed for. Although they are reactionary to the post-Socratic philosophers such as Plato, Aristotle, and aforementioned modern philosophers, their reaction took place as the counterarguments against the post-Socratic philosophies so that the influence of Plato and Aristotle cannot be ignored even in their reactionary attitude.

In conclusion, regardless of which perspective, Platonic or Aristotelian, to take and of challenging against both of them, none can escape from the influence of Plato (the legitimate Socrates’s predecessor) and Aristotle (the post-Socratic influencer). Without these two legends, the entire human world history would have been a really different by means of its characteristics as well as its quality. This dichotomic theoretical development has trained human individuals to enable their world view to rationally analyse themselves and their living world to encourage their evolution. 

Friday, August 26, 2022

The AWS IoT architectural plan for manufacturering companies

 

While working for various manufacturing industry, it is often wondering whether their administrative processes can be more efficient. They had better adopt the internet of things (IoT) and the cloud data management. These manufacturers and their retailers should take an advantage of the currently available public cloud technology as the means of the digital transformation (DX) which national governments frequently put emphasis on nowadays.
 
There are still many manually carried out tasks in a manufacturing business. There are too many repetitive input and output processes which can be reduced by sharing the database via the globally connected public cloud network. Furthermore, by applying the artificial intelligence (AI) and the statistical inferences using the shared database, it will instantly optimise balancing the available supply of production and stock and the demand from the purchase order.
 
Let’s examine the possibility of the IoT tool for the manufacturing industrial DX with reference to Amazon Web Service (AWS), the public cloud infrastructure provider accounting for the largest public cloud market share at 33%. The whole company group across regional and even national borders can share the same Amazon Elastic Computer Cloud (EC2) and various types of databases such as Amazon Relational Database Service (RDS) for structured data and Amazon Dynamo DB for non-structured data inside the AWS network. In addition, various advanced technologies for gathering streaming data, big data analysis, and the artificial intelligence (AI) based deep learning are available.
 
Sharing EC2 enables all the members across the borders to access applications and data installed into the shared platform inside the public cloud infrastructure. This prevents the repetitive processes of forwarding data between the departments by logging in from each location. Vendors outside the company group can also directly access the platform within the restriction by the information privacy. Moreover, the risk of causing the security hole of the entire network can be mitigated under the unified cyber security tool and various firewalls already prepared by the AWS instead of expecting all the departments to look after under their own responsibility.
 
Please kindly refer to this architectural map to read the following parts.
 
Amazon Kinesis can collect the real time streaming data from a factory to send this data to the IoT device set. This IoT devices prepared in the public cloud enable to control and monitor the production line and the storage conditions by simultaneously referring to both the external and the internal data timely delivered to the production site. There is also the correlational data-analysis estimating the potential influence over the storage volume and the quality control in advance. Thus, this is expected to prevent some critical supply management errors such as mismatching the recorded data and the actual data.
 
The information related to the product supply is then forwarded to the database. The database also simultaneously collects the purchase order data processed the retail management side. Then, AWS Lambda analyses these simultaneously collected data to send to the AI module called Amazon SageMaker offering the deep-learning analysis of various factors. Instead of allocating the costly human resources for bridging between the production site and the customer side, this automated data-link is expected to instantly match the supply requirements with the timely demand requirements without the conventional time-consuming negotiation.
 
Amazon SageMaker, the AI module, connected with the big data of the business is expected to enable this manufacturing business to optimise both demand and supply simultaneously at an instant pace. The production supply and its logistics can be optimised by referring to the customer demand trends and the exogenous factors influencing the supply quantity and quality.
 
These simultaneous data analyses can instantly offer the timely business management reports by using the database specialising in the graph presentation with some analytic footnotes such as Amazon Neptune and Amazon Redshift. This automated process can eliminate the conventional repetitive manual workloads. Moreover, it helps their management decision process with a fast objective report purely based on the mechanical data analysis because this new reporting system prevents the human bias and errors.
 
Regarding the customer relation, the manufacturer may directly contact to and deal with their customers via their own retailing website which can be directly connected to the entire supply management system equipped with the IoT devices and the big data analytics. They may no longer need their retail specialist agents negotiating between the manufacturer and their customers. All the conventional middle-men jobs are automatically carried out within the entire public cloud architectural mechanism with little humans’ help.
 
This autoscaling mechanism of the public cloud can instantly adjust the customer service costs depending on the real time demand volume. The conventional way relying on the contracted retailers requires to keep paying the agent fee regardless of the sales shortage. Furthermore, this conventional way cannot catch up with the suddenly but temporarily increasing sales volume. The human retailers are unable to be scaled up/down instantly like machines. By contrast, this new system is literally the machine base with the excellent scalability! Therefore, there is neither excess nor shortage of the product supply volume regardless of any demand level on spot.
 
Overall, this public cloud provision is efficient by means of not only time-wise but also cost-wise. It reduces the reliance on humans’ intuition requiring the long-term experience as well as the complex human relationship easily causing some corruption issues.