Merge pull request #63 from IamCarbonMan/master

Added light and dark options
This commit is contained in:
Lazo 2017-06-25 19:02:49 -04:00 committed by GitHub
commit b32ed4b9e2
5 changed files with 535 additions and 0 deletions

493
Data/light-dark.txt Normal file
View file

@ -0,0 +1,493 @@
bulbasaur 0.61604
ivysaur 0.462721
venusaur 0.5451
charmander 0.724984
charmeleon 0.491232
charizard 0.601881
squirtle 0.708672
wartortle 0.748101
blastoise 0.64938
caterpie 0.718227
metapod 0.621901
butterfree 0.630765
weedle 0.638418
kakuna 0.773358
beedrill 0.802686
pidgey 0.460133
pidgeotto 0.906494
pidgeot 0.887968
rattata 0.478938
raticate 0.640308
spearow 0.459023
fearow 0.488446
ekans 0.463613
arbok 0.589331
pikachu 0.851867
raichu 0.751316
sandshrew 0.77978
sandslash 0.730616
nidoran 0.759855
nidorina 0.681913
nidoqueen 0.633158
nidoran 0.414212
nidorino 0.535174
nidoking 0.487512
clefairy 0.839059
clefable 0.863238
vulpix 0.555764
ninetales 0.92374
jigglypuff 0.800818
wigglytuff 0.777334
zubat 0.463772
golbat 0.376687
oddish 0.477076
gloom 0.558871
vileplume 0.386918
paras 0.602374
parasect 0.571063
venonat 0.38278
venomoth 0.642519
diglett 0.561415
dugtrio 0.476553
meowth 0.91165
persian 0.861286
psyduck 0.798752
golduck 0.674705
mankey 0.902441
primeape 0.89772
growlithe 0.65431
arcanine 0.864944
poliwag 0.535375
poliwhirl 0.550271
poliwrath 0.577639
abra 0.82454
kadabra 0.852543
alakazam 0.797661
machop 0.755805
machoke 0.623455
machamp 0.670823
bellsprout 0.817864
weepinbell 0.864195
victreebel 0.84222
tentacool 0.649035
tentacruel 0.0574754
geodude 0.645383
graveler 0.697487
golem 0.558651
ponyta 0.827553
rapidash 0.8708
slowpoke 0.72033
slowbro 0.683053
magnemite 0.705858
magneton 0.708434
farfetch'd 0.595665
doduo 0.619222
dodrio 0.62457
seel 0.931629
dewgong 0.858439
grimer 0.500468
muk 0.467463
shellder 0.501135
cloyster 0.483847
gastly 0.43826
haunter 0.485071
gengar 0.274986
onix 0.564071
drowzee 0.728724
hypno 0.839396
krabby 0.852155
kingler 0.795094
voltorb 0.322391
electrode 0.98033
exeggcute 0.863465
exeggutor 0.588666
cubone 0.724451
marowak 0.706728
hitmonlee 0.562188
hitmonchan 0.701743
lickitung 0.723693
koffing 0.63856
weezing 0.658479
rhyhorn 0.687025
rhydon 0.628743
chansey 0.858906
tangela 0.528551
kangaskhan 0.51619
horsea 0.775569
seadra 0.741227
goldeen 0.944483
seaking 0.516814
staryu 0.547556
starmie 0.608698
mr. 0.852766
scyther 0.685216
jynx 0.304172
electabuzz 0.8172
magmar 0.424369
pinsir 0.676132
tauros 0.663027
magikarp 0.590442
gyarados 0.454836
lapras 0.486099
ditto 0.622399
eevee 0.59138
vaporeon 0.716208
jolteon 0.801198
flareon 0.561471
porygon 0.40719
omanyte 0.706038
omastar 0.771284
kabuto 0.0760635
kabutops 0.602599
aerodactyl 0.675558
snorlax 0.50947
articuno 0.615042
zapdos 0.813707
moltres 0.74996
dratini 0.73172
dragonair 0.629152
dragonite 0.744656
mewtwo 0.846847
mew 0.815818
chikorita 0.861505
bayleef 0.901646
meganium 0.702821
cyndaquil 0.853288
quilava 0.850405
typhlosion 0.796257
totodile 0.610843
croconaw 0.678851
feraligatr 0.663142
sentret 0.504492
furret 0.763536
hoothoot 0.532158
noctowl 0.46978
ledyba 0.487187
ledian 0.418694
spinarak 0.702303
ariados 0.474765
crobat 0.485866
chinchou 0.602483
lanturn 0.632621
pichu 0.886557
cleffa 0.854177
igglybuff 0.890948
togepi 0.974374
togetic 0.919818
natu 0.673518
xatu 0.693199
mareep 0.894504
flaaffy 0.790988
ampharos 0.757293
bellossom 0.777804
marill 0.637
azumarill 0.541738
sudowoodo 0.524254
politoed 0.69556
hoppip 0.6714
skiploom 0.678718
jumpluff 0.576306
aipom 0.550648
sunkern 0.814766
sunflora 0.881064
yanma 0.452699
wooper 0.833696
quagsire 0.730816
espeon 0.732087
umbreon 0.144064
murkrow 0.201785
slowking 0.650835
misdreavus 0.374371
unown 0.324886
wobbuffet 0.618024
girafarig 0.692634
pineco 0.479762
forretress 0.670095
dunsparce 0.879011
gligar 0.624398
steelix 0.53062
snubbull 0.633274
granbull 0.573458
qwilfish 0.870388
scizor 0.286946
shuckle 0.383
heracross 0.312401
sneasel 0.233976
teddiursa 0.664395
ursaring 0.509506
slugma 0.501634
magcargo 0.566186
swinub 0.590632
piloswine 0.535605
corsola 0.673841
remoraid 0.807987
octillery 0.377279
delibird 0.417711
mantine 0.697284
skarmory 0.80817
houndour 0.321382
houndoom 0.375787
kingdra 0.643796
phanpy 0.719229
donphan 0.755039
porygon2 0.471431
stantler 0.645821
smeargle 0.895412
tyrogue 0.732042
hitmontop 0.657826
smoochum 0.613722
elekid 0.713664
magby 0.56141
miltank 0.676376
blissey 0.716088
raikou 0.792091
entei 0.164723
suicune 0.718651
larvitar 0.655129
pupitar 0.683949
tyranitar 0.740855
lugia 0.854093
ho-oh 0.456829
celebi 0.914585
treecko 0.789267
grovyle 0.710269
sceptile 0.7234
torchic 0.611063
combusken 0.566604
blaziken 0.823418
mudkip 0.601698
marshtomp 0.60155
swampert 0.582725
poochyena 0.659817
mightyena 0.729255
zigzagoon 0.826714
linoone 0.763825
wurmple 0.888278
silcoon 0.86649
beautifly 0.411765
cascoon 0.825882
dustox 0.590593
lotad 0.496519
lombre 0.702942
ludicolo 0.662457
seedot 0.527105
nuzleaf 0.620504
shiftry 0.59948
taillow 0.37519
swellow 0.287707
wingull 0.789535
pelipper 0.902759
ralts 0.939809
kirlia 0.959133
gardevoir 0.649517
surskit 0.767106
masquerain 0.801517
shroomish 0.597057
breloom 0.85317
slakoth 0.82493
vigoroth 0.898085
slaking 0.525411
nincada 0.960731
ninjask 0.208803
shedinja 0.715377
whismur 0.786548
loudred 0.522184
exploud 0.620426
makuhita 0.859654
hariyama 0.847462
azurill 0.490813
nosepass 0.288598
skitty 0.705455
delcatty 0.867468
sableye 0.449862
mawile 0.780275
aron 0.760185
lairon 0.426203
aggron 0.526279
meditite 0.73075
medicham 0.825481
electrike 0.703969
manectric 0.660832
plusle 0.90071
minun 0.911575
volbeat 0.619725
illumise 0.70883
roselia 0.74602
gulpin 0.721942
swalot 0.579722
carvanha 0.32407
sharpedo 0.807318
wailmer 0.378056
wailord 0.48029
numel 0.838816
camerupt 0.581801
torkoal 0.682765
spoink 0.645841
grumpig 0.6022
spinda 0.810219
trapinch 0.602283
vibrava 0.827242
flygon 0.760615
cacnea 0.643642
cacturne 0.673486
swablu 0.692523
altaria 0.914359
zangoose 0.955059
seviper 0.415772
lunatone 0.843258
solrock 0.503932
barboach 0.791458
whiscash 0.285956
corphish 0.818555
crawdaunt 0.443998
baltoy 0.758668
claydol 0.358909
lileep 0.480308
cradily 0.675871
anorith 0.55059
armaldo 0.510346
feebas 0.753104
milotic 0.869479
castform 0.824363
kecleon 0.712634
shuppet 0.523015
banette 0.592839
duskull 0.407622
dusclops 0.73202
tropius 0.572509
chimecho 0.833826
absol 0.803023
wynaut 0.707459
snorunt 0.27341
glalie 0.355935
spheal 0.657501
sealeo 0.686642
walrein 0.60321
clamperl 0.633663
huntail 0.593536
gorebyss 0.746509
relicanth 0.348452
luvdisc 0.682499
bagon 0.677044
shelgon 0.83147
salamence 0.653867
beldum 0.563534
metang 0.533696
metagross 0.53279
regirock 0.741491
regice 0.683548
registeel 0.623046
latias 0.982893
latios 0.876962
kyogre 0.384149
groudon 0.0902245
rayquaza 0.468595
jirachi 0.978042
deoxys 0.618088
turtwig 0.773515
grotle 0.604132
torterra 0.457409
chimchar 0.663174
monferno 0.631232
infernape 0.945496
piplup 0.745585
prinplup 0.405031
empoleon 0.262553
starly 0.26931
staravia 0.282412
staraptor 0.481331
bidoof 0.467715
bibarel 0.588023
kricketot 0.430597
kricketune 0.405649
shinx 0.631029
luxio 0.612493
luxray 0.235459
budew 0.703137
roserade 0.813278
cranidos 0.47046
rampardos 0.310159
shieldon 0.731566
bastiodon 0.774646
burmy 0.547375
wormadam 0.501587
mothim 0.332024
combee 0.766668
vespiquen 0.71957
pachirisu 0.892119
buizel 0.603754
floatzel 0.545801
cherubi 0.529458
cherrim 0.763485
shellos 0.60342
gastrodon 0.438932
ambipom 0.540427
drifloon 0.571655
drifblim 0.524227
buneary 0.538228
lopunny 0.53163
mismagius 0.332848
honchkrow 0.319731
glameow 0.605219
purugly 0.430523
chingling 0.791304
stunky 0.255749
skuntank 0.26677
bronzor 0.55897
bronzong 0.636318
bonsly 0.512233
mime 0.847604
happiny 0.839292
chatot 0.49433
spiritomb 0.70014
gible 0.476057
gabite 0.399648
garchomp 0.333349
munchlax 0.422614
riolu 0.624587
lucario 0.535689
hippopotas 0.740069
hippowdon 0.608923
skorupi 0.248446
drapion 0.517049
croagunk 0.566172
toxicroak 0.53118
carnivine 0.734641
finneon 0.291408
lumineon 0.303825
mantyke 0.763958
snover 0.96865
abomasnow 0.990744
weavile 0.286989
magnezone 0.75966
lickilicky 0.614629
rhyperior 0.416519
tangrowth 0.470169
electivire 0.794939
magmortar 0.372137
togekiss 0.898987
yanmega 0.32405
leafeon 0.901089
glaceon 0.810771
gliscor 0.649418
mamoswine 0.548716
porygon-z 0.367984
gallade 0.382547
probopass 0.488307
dusknoir 0.679651
froslass 0.936162
rotom 0.543941
uxie 0.81938
mesprit 0.772561
azelf 0.780311
dialga 0.272122
palkia 0.588943
heatran 0.291081
regigigas 0.927366
giratina 0.263429
cresselia 0.677861
phione 0.661622
manaphy 0.709464
darkrai 0.364973
shaymin 0.918656
arceus 0.899249

View file

@ -91,6 +91,8 @@ Other Parameters:
slideshow-<region> [time] - Iterate through each Pokemon in the specified region. Optional time (in seconds) between Pokemon.
rnd-slideshow [time] - Iterate through each Pokemon in a random order. Optional time (in seconds) between Pokemon.
rnd-slideshow-<region> [time] - Iterate through each Pokemon in the specified region in a random order. Optional time (in seconds) between Pokemon.
light - Change the terminal background to a random light-colored Pokemon.
dark - Change the terminal background to a random dark-colored Pokemon.
clear | disable | off - Clear the Pokemon in the terminal.
help - Display this menu.

View file

@ -93,6 +93,22 @@ class Database:
# Get all the Extra Pokemon images available.
return self.__get_region(None)
def get_light(self, threshold=0.4, all=False):
with open(self.directory + "/./Data/light-dark.txt", 'r') as data_file:
lines = [line.strip() for line in data_file.readlines()]
values = [float(line.split(' ')[1]) for line in lines]
names = [line.split(' ')[0] for line in lines]
light = [names[i] for i,v in enumerate(values) if v > threshold]
return light if all else random.choice(light)
def get_dark(self, threshold=0.6, all=False):
with open(self.directory + "/./Data/light-dark.txt", 'r') as data_file:
lines = [line.strip() for line in data_file.readlines()]
values = [float(line.split(' ')[1]) for line in lines]
names = [line.split(' ')[0] for line in lines]
dark = [names[i] for i,v in enumerate(values) if v < threshold]
return dark if all else random.choice(dark)
def __get_region(self, region):
# Helper method for getting all the Pokemon of a specified region.
return [pokemon for pokemon in self.__pokemon_list

20
main.py
View file

@ -75,6 +75,8 @@ Other Parameters:
slideshow-<region> [time] - Iterate through each Pokemon in the specified region. Optional time (in seconds) between Pokemon.
rnd-slideshow [time] - Iterate through each Pokemon in a random order. Optional time (in seconds) between Pokemon.
rnd-slideshow-<region> [time] - Iterate through each Pokemon in the specified region in a random order. Optional time (in seconds) between Pokemon.
light - Change the terminal background to a random light-colored Pokemon.
dark - Change the terminal background to a random dark-colored Pokemon.
clear | disable | off - Clear the Pokemon in the terminal.
help - Display this menu.
@ -227,6 +229,24 @@ def single_argument_handler(arg):
change_terminal_background(db, db.get_random_from_region("hoenn").get_name())
elif arg == "random-sinnoh":
change_terminal_background(db, db.get_random_from_region("sinnoh").get_name())
elif arg == "light" and escape_code:
change_wallpaper(db, db.get_light().get_name())
elif arg == "dark" and escape_code:
change_wallpaper(db, db.get_dark().get_name())
elif arg == "light":
change_terminal_background(db, db.get_light())
elif arg == "dark":
change_terminal_background(db, db.get_dark())
elif arg == "slideshow":
slideshow(db, 1, 494)
elif arg == "slideshow-kanto":
slideshow(db, 1, 152)
elif arg == "slideshow-johto":
slideshow(db, 152, 252)
elif arg == "slideshow-hoenn":
slideshow(db, 252, 387)
elif arg == "slideshow-sinnoh":
slideshow(db, 387, 494)
elif arg.endswith("slideshow"):
slideshow(db, 1, 494, rand=arg.startswith("rnd"))
elif arg.endswith("slideshow-kanto"):

View file

@ -62,6 +62,10 @@ def test_database_double_arg(arg):
print_items(db.names_with_prefix(arg2))
elif arg1 == "names_with_infix":
print_items(db.names_with_infix(arg2))
elif arg1 == "get_light":
print_items(db.get_light(threshold=int(arg2)/10, all=True))
elif arg1 == "get_dark":
print_items(db.get_dark(threshold=int(arg2)/10, all=True))
else:
print("No such public method '" + arg + "' with two parameters exists in the Database class.")