From f52c73ed9b2697e799ac9ed8fc18ff153039ba28 Mon Sep 17 00:00:00 2001 From: Griffin Young Date: Sat, 24 Jun 2017 19:51:50 -0700 Subject: [PATCH 1/7] added light and dark options --- Data/dark.txt | 192 ++++++++++++++++++++++ Data/light.txt | 436 +++++++++++++++++++++++++++++++++++++++++++++++++ database.py | 8 + main.py | 8 + 4 files changed, 644 insertions(+) create mode 100644 Data/dark.txt create mode 100644 Data/light.txt diff --git a/Data/dark.txt b/Data/dark.txt new file mode 100644 index 0000000..6a4b6f5 --- /dev/null +++ b/Data/dark.txt @@ -0,0 +1,192 @@ +002 +003 +005 +016 +019 +021 +022 +023 +024 +032 +033 +034 +037 +041 +042 +043 +044 +045 +047 +048 +050 +051 +060 +061 +062 +073 +076 +083 +088 +089 +090 +091 +092 +093 +094 +095 +100 +103 +106 +114 +115 +119 +120 +124 +126 +129 +130 +131 +133 +136 +137 +140 +143 +161 +163 +164 +165 +166 +168 +169 +184 +185 +189 +190 +193 +197 +198 +200 +201 +204 +208 +210 +212 +213 +214 +215 +217 +218 +219 +220 +221 +224 +225 +228 +229 +233 +240 +244 +250 +256 +260 +267 +269 +270 +273 +275 +276 +277 +285 +289 +291 +294 +298 +299 +302 +305 +306 +317 +318 +320 +321 +323 +336 +338 +340 +342 +344 +345 +347 +348 +353 +354 +355 +357 +361 +362 +367 +369 +374 +375 +376 +382 +383 +384 +389 +394 +395 +396 +397 +398 +399 +400 +401 +402 +405 +408 +409 +412 +413 +414 +419 +420 +423 +424 +425 +426 +427 +428 +429 +430 +432 +434 +435 +436 +438 +441 +443 +444 +445 +446 +448 +451 +452 +453 +454 +456 +457 +461 +464 +465 +467 +469 +473 +474 +475 +476 +479 +483 +484 +485 +487 +491 \ No newline at end of file diff --git a/Data/light.txt b/Data/light.txt new file mode 100644 index 0000000..c7fc83c --- /dev/null +++ b/Data/light.txt @@ -0,0 +1,436 @@ +001 +002 +003 +004 +005 +006 +007 +008 +009 +010 +011 +012 +013 +014 +015 +016 +017 +018 +019 +020 +021 +022 +023 +024 +025 +026 +027 +028 +029 +030 +031 +032 +033 +034 +035 +036 +037 +038 +039 +040 +041 +043 +044 +046 +047 +049 +050 +051 +052 +053 +054 +055 +056 +057 +058 +059 +060 +061 +062 +063 +064 +065 +066 +067 +068 +069 +070 +071 +072 +074 +075 +076 +077 +078 +079 +080 +081 +082 +083 +084 +085 +086 +087 +088 +089 +090 +091 +092 +093 +095 +096 +097 +098 +099 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +199 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +216 +217 +218 +219 +220 +221 +222 +223 +225 +226 +227 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +292 +293 +294 +295 +296 +297 +298 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +319 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +341 +342 +343 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +363 +364 +365 +366 +367 +368 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +398 +399 +400 +401 +402 +403 +404 +406 +407 +408 +410 +411 +412 +413 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +431 +432 +433 +436 +437 +438 +439 +440 +441 +442 +443 +446 +447 +448 +449 +450 +452 +453 +454 +455 +458 +459 +460 +462 +463 +464 +465 +466 +468 +470 +471 +472 +473 +476 +477 +478 +479 +480 +481 +482 +484 +486 +488 +489 +490 +492 +493 \ No newline at end of file diff --git a/database.py b/database.py index b291351..d200a5d 100644 --- a/database.py +++ b/database.py @@ -93,6 +93,14 @@ class Database: # Get all the Extra Pokemon images available. return self.__get_region(None) + def get_light(self): + with open(self.directory + "/./Data/light.txt", 'r') as data_file: + return int(random.choice([line.strip() for line in data_file.readlines()])) + + def get_dark(self): + with open(self.directory + "/./Data/dark.txt", 'r') as data_file: + return int(random.choice([line.strip() for line in data_file.readlines()])) + def __get_region(self, region): # Helper method for getting all the Pokemon of a specified region. return [pokemon for pokemon in self.__pokemon_list diff --git a/main.py b/main.py index 7b6e49c..438495c 100755 --- a/main.py +++ b/main.py @@ -218,6 +218,14 @@ 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()) + elif arg == "dark" and escape_code: + change_wallpaper(db, db.get_dark()) + 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": From 016c0fc91f23e8e700f729553f63ae93de5fc385 Mon Sep 17 00:00:00 2001 From: Griffin Young Date: Sun, 25 Jun 2017 11:12:45 -0700 Subject: [PATCH 2/7] added threshold and all options to get_light/get_dark. added full light-dark table. added unit test --- Data/dark.txt | 192 ----------------- Data/light-dark.txt | 493 ++++++++++++++++++++++++++++++++++++++++++++ Data/light.txt | 436 --------------------------------------- database.py | 22 +- main.py | 8 +- unittest.py | 4 + 6 files changed, 517 insertions(+), 638 deletions(-) delete mode 100644 Data/dark.txt create mode 100644 Data/light-dark.txt delete mode 100644 Data/light.txt diff --git a/Data/dark.txt b/Data/dark.txt deleted file mode 100644 index 6a4b6f5..0000000 --- a/Data/dark.txt +++ /dev/null @@ -1,192 +0,0 @@ -002 -003 -005 -016 -019 -021 -022 -023 -024 -032 -033 -034 -037 -041 -042 -043 -044 -045 -047 -048 -050 -051 -060 -061 -062 -073 -076 -083 -088 -089 -090 -091 -092 -093 -094 -095 -100 -103 -106 -114 -115 -119 -120 -124 -126 -129 -130 -131 -133 -136 -137 -140 -143 -161 -163 -164 -165 -166 -168 -169 -184 -185 -189 -190 -193 -197 -198 -200 -201 -204 -208 -210 -212 -213 -214 -215 -217 -218 -219 -220 -221 -224 -225 -228 -229 -233 -240 -244 -250 -256 -260 -267 -269 -270 -273 -275 -276 -277 -285 -289 -291 -294 -298 -299 -302 -305 -306 -317 -318 -320 -321 -323 -336 -338 -340 -342 -344 -345 -347 -348 -353 -354 -355 -357 -361 -362 -367 -369 -374 -375 -376 -382 -383 -384 -389 -394 -395 -396 -397 -398 -399 -400 -401 -402 -405 -408 -409 -412 -413 -414 -419 -420 -423 -424 -425 -426 -427 -428 -429 -430 -432 -434 -435 -436 -438 -441 -443 -444 -445 -446 -448 -451 -452 -453 -454 -456 -457 -461 -464 -465 -467 -469 -473 -474 -475 -476 -479 -483 -484 -485 -487 -491 \ No newline at end of file diff --git a/Data/light-dark.txt b/Data/light-dark.txt new file mode 100644 index 0000000..29e727b --- /dev/null +++ b/Data/light-dark.txt @@ -0,0 +1,493 @@ +001 0.61604 +002 0.462721 +003 0.5451 +004 0.724984 +005 0.491232 +006 0.601881 +007 0.708672 +008 0.748101 +009 0.64938 +010 0.718227 +011 0.621901 +012 0.630765 +013 0.638418 +014 0.773358 +015 0.802686 +016 0.460133 +017 0.906494 +018 0.887968 +019 0.478938 +020 0.640308 +021 0.459023 +022 0.488446 +023 0.463613 +024 0.589331 +025 0.851867 +026 0.751316 +027 0.77978 +028 0.730616 +029 0.759855 +030 0.681913 +031 0.633158 +032 0.414212 +033 0.535174 +034 0.487512 +035 0.839059 +036 0.863238 +037 0.555764 +038 0.92374 +039 0.800818 +040 0.777334 +041 0.463772 +042 0.376687 +043 0.477076 +044 0.558871 +045 0.386918 +046 0.602374 +047 0.571063 +048 0.38278 +049 0.642519 +050 0.561415 +051 0.476553 +052 0.91165 +053 0.861286 +054 0.798752 +055 0.674705 +056 0.902441 +057 0.89772 +058 0.65431 +059 0.864944 +060 0.535375 +061 0.550271 +062 0.577639 +063 0.82454 +064 0.852543 +065 0.797661 +066 0.755805 +067 0.623455 +068 0.670823 +069 0.817864 +070 0.864195 +071 0.84222 +072 0.649035 +073 0.0574754 +074 0.645383 +075 0.697487 +076 0.558651 +077 0.827553 +078 0.8708 +079 0.72033 +080 0.683053 +081 0.705858 +082 0.708434 +083 0.595665 +084 0.619222 +085 0.62457 +086 0.931629 +087 0.858439 +088 0.500468 +089 0.467463 +090 0.501135 +091 0.483847 +092 0.43826 +093 0.485071 +094 0.274986 +095 0.564071 +096 0.728724 +097 0.839396 +098 0.852155 +099 0.795094 +100 0.322391 +101 0.98033 +102 0.863465 +103 0.588666 +104 0.724451 +105 0.706728 +106 0.562188 +107 0.701743 +108 0.723693 +109 0.63856 +110 0.658479 +111 0.687025 +112 0.628743 +113 0.858906 +114 0.528551 +115 0.51619 +116 0.775569 +117 0.741227 +118 0.944483 +119 0.516814 +120 0.547556 +121 0.608698 +122 0.852766 +123 0.685216 +124 0.304172 +125 0.8172 +126 0.424369 +127 0.676132 +128 0.663027 +129 0.590442 +130 0.454836 +131 0.486099 +132 0.622399 +133 0.59138 +134 0.716208 +135 0.801198 +136 0.561471 +137 0.40719 +138 0.706038 +139 0.771284 +140 0.0760635 +141 0.602599 +142 0.675558 +143 0.50947 +144 0.615042 +145 0.813707 +146 0.74996 +147 0.73172 +148 0.629152 +149 0.744656 +150 0.846847 +151 0.815818 +152 0.861505 +153 0.901646 +154 0.702821 +155 0.853288 +156 0.850405 +157 0.796257 +158 0.610843 +159 0.678851 +160 0.663142 +161 0.504492 +162 0.763536 +163 0.532158 +164 0.46978 +165 0.487187 +166 0.418694 +167 0.702303 +168 0.474765 +169 0.485866 +170 0.602483 +171 0.632621 +172 0.886557 +173 0.854177 +174 0.890948 +175 0.974374 +176 0.919818 +177 0.673518 +178 0.693199 +179 0.894504 +180 0.790988 +181 0.757293 +182 0.777804 +183 0.637 +184 0.541738 +185 0.524254 +186 0.69556 +187 0.6714 +188 0.678718 +189 0.576306 +190 0.550648 +191 0.814766 +192 0.881064 +193 0.452699 +194 0.833696 +195 0.730816 +196 0.732087 +197 0.144064 +198 0.201785 +199 0.650835 +200 0.374371 +201 0.324886 +202 0.618024 +203 0.692634 +204 0.479762 +205 0.670095 +206 0.879011 +207 0.624398 +208 0.53062 +209 0.633274 +210 0.573458 +211 0.870388 +212 0.286946 +213 0.383 +214 0.312401 +215 0.233976 +216 0.664395 +217 0.509506 +218 0.501634 +219 0.566186 +220 0.590632 +221 0.535605 +222 0.673841 +223 0.807987 +224 0.377279 +225 0.417711 +226 0.697284 +227 0.80817 +228 0.321382 +229 0.375787 +230 0.643796 +231 0.719229 +232 0.755039 +233 0.471431 +234 0.645821 +235 0.895412 +236 0.732042 +237 0.657826 +238 0.613722 +239 0.713664 +240 0.56141 +241 0.676376 +242 0.716088 +243 0.792091 +244 0.164723 +245 0.718651 +246 0.655129 +247 0.683949 +248 0.740855 +249 0.854093 +250 0.456829 +251 0.914585 +252 0.789267 +253 0.710269 +254 0.7234 +255 0.611063 +256 0.566604 +257 0.823418 +258 0.601698 +259 0.60155 +260 0.582725 +261 0.659817 +262 0.729255 +263 0.826714 +264 0.763825 +265 0.888278 +266 0.86649 +267 0.411765 +268 0.825882 +269 0.590593 +270 0.496519 +271 0.702942 +272 0.662457 +273 0.527105 +274 0.620504 +275 0.59948 +276 0.37519 +277 0.287707 +278 0.789535 +279 0.902759 +280 0.939809 +281 0.959133 +282 0.649517 +283 0.767106 +284 0.801517 +285 0.597057 +286 0.85317 +287 0.82493 +288 0.898085 +289 0.525411 +290 0.960731 +291 0.208803 +292 0.715377 +293 0.786548 +294 0.522184 +295 0.620426 +296 0.859654 +297 0.847462 +298 0.490813 +299 0.288598 +300 0.705455 +301 0.867468 +302 0.449862 +303 0.780275 +304 0.760185 +305 0.426203 +306 0.526279 +307 0.73075 +308 0.825481 +309 0.703969 +310 0.660832 +311 0.90071 +312 0.911575 +313 0.619725 +314 0.70883 +315 0.74602 +316 0.721942 +317 0.579722 +318 0.32407 +319 0.807318 +320 0.378056 +321 0.48029 +322 0.838816 +323 0.581801 +324 0.682765 +325 0.645841 +326 0.6022 +327 0.810219 +328 0.602283 +329 0.827242 +330 0.760615 +331 0.643642 +332 0.673486 +333 0.692523 +334 0.914359 +335 0.955059 +336 0.415772 +337 0.843258 +338 0.503932 +339 0.791458 +340 0.285956 +341 0.818555 +342 0.443998 +343 0.758668 +344 0.358909 +345 0.480308 +346 0.675871 +347 0.55059 +348 0.510346 +349 0.753104 +350 0.869479 +351 0.824363 +352 0.712634 +353 0.523015 +354 0.592839 +355 0.407622 +356 0.73202 +357 0.572509 +358 0.833826 +359 0.803023 +360 0.707459 +361 0.27341 +362 0.355935 +363 0.657501 +364 0.686642 +365 0.60321 +366 0.633663 +367 0.593536 +368 0.746509 +369 0.348452 +370 0.682499 +371 0.677044 +372 0.83147 +373 0.653867 +374 0.563534 +375 0.533696 +376 0.53279 +377 0.741491 +378 0.683548 +379 0.623046 +380 0.982893 +381 0.876962 +382 0.384149 +383 0.0902245 +384 0.468595 +385 0.978042 +386 0.618088 +387 0.773515 +388 0.604132 +389 0.457409 +390 0.663174 +391 0.631232 +392 0.945496 +393 0.745585 +394 0.405031 +395 0.262553 +396 0.26931 +397 0.282412 +398 0.481331 +399 0.467715 +400 0.588023 +401 0.430597 +402 0.405649 +403 0.631029 +404 0.612493 +405 0.235459 +406 0.703137 +407 0.813278 +408 0.47046 +409 0.310159 +410 0.731566 +411 0.774646 +412 0.547375 +413 0.501587 +414 0.332024 +415 0.766668 +416 0.71957 +417 0.892119 +418 0.603754 +419 0.545801 +420 0.529458 +421 0.763485 +422 0.60342 +423 0.438932 +424 0.540427 +425 0.571655 +426 0.524227 +427 0.538228 +428 0.53163 +429 0.332848 +430 0.319731 +431 0.605219 +432 0.430523 +433 0.791304 +434 0.255749 +435 0.26677 +436 0.55897 +437 0.636318 +438 0.512233 +439 0.847604 +440 0.839292 +441 0.49433 +442 0.70014 +443 0.476057 +444 0.399648 +445 0.333349 +446 0.422614 +447 0.624587 +448 0.535689 +449 0.740069 +450 0.608923 +451 0.248446 +452 0.517049 +453 0.566172 +454 0.53118 +455 0.734641 +456 0.291408 +457 0.303825 +458 0.763958 +459 0.96865 +460 0.990744 +461 0.286989 +462 0.75966 +463 0.614629 +464 0.416519 +465 0.470169 +466 0.794939 +467 0.372137 +468 0.898987 +469 0.32405 +470 0.901089 +471 0.810771 +472 0.649418 +473 0.548716 +474 0.367984 +475 0.382547 +476 0.488307 +477 0.679651 +478 0.936162 +479 0.543941 +480 0.81938 +481 0.772561 +482 0.780311 +483 0.272122 +484 0.588943 +485 0.291081 +486 0.927366 +487 0.263429 +488 0.677861 +489 0.661622 +490 0.709464 +491 0.364973 +492 0.918656 +493 0.899249 diff --git a/Data/light.txt b/Data/light.txt deleted file mode 100644 index c7fc83c..0000000 --- a/Data/light.txt +++ /dev/null @@ -1,436 +0,0 @@ -001 -002 -003 -004 -005 -006 -007 -008 -009 -010 -011 -012 -013 -014 -015 -016 -017 -018 -019 -020 -021 -022 -023 -024 -025 -026 -027 -028 -029 -030 -031 -032 -033 -034 -035 -036 -037 -038 -039 -040 -041 -043 -044 -046 -047 -049 -050 -051 -052 -053 -054 -055 -056 -057 -058 -059 -060 -061 -062 -063 -064 -065 -066 -067 -068 -069 -070 -071 -072 -074 -075 -076 -077 -078 -079 -080 -081 -082 -083 -084 -085 -086 -087 -088 -089 -090 -091 -092 -093 -095 -096 -097 -098 -099 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -199 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -216 -217 -218 -219 -220 -221 -222 -223 -225 -226 -227 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -292 -293 -294 -295 -296 -297 -298 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -319 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335 -336 -337 -338 -339 -341 -342 -343 -345 -346 -347 -348 -349 -350 -351 -352 -353 -354 -355 -356 -357 -358 -359 -360 -363 -364 -365 -366 -367 -368 -370 -371 -372 -373 -374 -375 -376 -377 -378 -379 -380 -381 -384 -385 -386 -387 -388 -389 -390 -391 -392 -393 -394 -398 -399 -400 -401 -402 -403 -404 -406 -407 -408 -410 -411 -412 -413 -415 -416 -417 -418 -419 -420 -421 -422 -423 -424 -425 -426 -427 -428 -431 -432 -433 -436 -437 -438 -439 -440 -441 -442 -443 -446 -447 -448 -449 -450 -452 -453 -454 -455 -458 -459 -460 -462 -463 -464 -465 -466 -468 -470 -471 -472 -473 -476 -477 -478 -479 -480 -481 -482 -484 -486 -488 -489 -490 -492 -493 \ No newline at end of file diff --git a/database.py b/database.py index d200a5d..ff0fb3a 100644 --- a/database.py +++ b/database.py @@ -93,13 +93,23 @@ class Database: # Get all the Extra Pokemon images available. return self.__get_region(None) - def get_light(self): - with open(self.directory + "/./Data/light.txt", 'r') as data_file: - return int(random.choice([line.strip() for line in data_file.readlines()])) + def get_light(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] + ids = [int(line.split(' ')[0]) for line in lines] + light = [ids[i] for i,v in enumerate(values) if v > threshold] + names = [self.__pokemon_list[i-1] for i in light] + return names if all else random.choice(names) - def get_dark(self): - with open(self.directory + "/./Data/dark.txt", 'r') as data_file: - return int(random.choice([line.strip() for line in data_file.readlines()])) + 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] + ids = [int(line.split(' ')[0]) for line in lines] + dark = [ids[i] for i,v in enumerate(values) if v < threshold] + names = [self.__pokemon_list[i-1] for i in dark] + return names if all else random.choice(names) def __get_region(self, region): # Helper method for getting all the Pokemon of a specified region. diff --git a/main.py b/main.py index 438495c..0140979 100755 --- a/main.py +++ b/main.py @@ -219,13 +219,13 @@ def single_argument_handler(arg): 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()) + change_wallpaper(db, db.get_light().get_name()) elif arg == "dark" and escape_code: - change_wallpaper(db, db.get_dark()) + change_wallpaper(db, db.get_dark().get_name()) elif arg == "light": - change_terminal_background(db, db.get_light()) + change_terminal_background(db, db.get_light().get_name()) elif arg == "dark": - change_terminal_background(db, db.get_dark()) + change_terminal_background(db, db.get_dark().get_name()) elif arg == "slideshow": slideshow(db, 1, 494) elif arg == "slideshow-kanto": diff --git a/unittest.py b/unittest.py index cfec2b9..55ceb48 100644 --- a/unittest.py +++ b/unittest.py @@ -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=float(arg2), all=True)) + elif arg1 == "get_dark": + print_items(db.get_dark(threshold=float(arg2), all=True)) else: print("No such public method '" + arg + "' with two parameters exists in the Database class.") From b8c7197c1c79a7d358943b3968564101bbd14a0c Mon Sep 17 00:00:00 2001 From: Griffin Young Date: Sun, 25 Jun 2017 11:15:44 -0700 Subject: [PATCH 3/7] unit test light-dark scale goes from 1-10 instead of 0-1 --- unittest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unittest.py b/unittest.py index 55ceb48..4950921 100644 --- a/unittest.py +++ b/unittest.py @@ -63,9 +63,9 @@ def test_database_double_arg(arg): elif arg1 == "names_with_infix": print_items(db.names_with_infix(arg2)) elif arg1 == "get_light": - print_items(db.get_light(threshold=float(arg2), all=True)) + print_items(db.get_light(threshold=int(arg2)/10, all=True)) elif arg1 == "get_dark": - print_items(db.get_dark(threshold=float(arg2), all=True)) + 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.") From 46da64488adfb75db8a69adf2a25173f6c3c2441 Mon Sep 17 00:00:00 2001 From: IamCarbonMan Date: Sun, 25 Jun 2017 11:26:03 -0700 Subject: [PATCH 4/7] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2a0d5e6..e088dc3 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,8 @@ Other Parameters: slideshow- [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- [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. From 62fceca4fae9c26d0a0301a97f6f3efd76eb22f9 Mon Sep 17 00:00:00 2001 From: Griffin Young Date: Sun, 25 Jun 2017 12:25:40 -0700 Subject: [PATCH 5/7] changed id -> name in light/dark data file --- Data/light-dark.txt | 986 ++++++++++++++++++++++---------------------- database.py | 14 +- 2 files changed, 499 insertions(+), 501 deletions(-) diff --git a/Data/light-dark.txt b/Data/light-dark.txt index 29e727b..1a5712c 100644 --- a/Data/light-dark.txt +++ b/Data/light-dark.txt @@ -1,493 +1,493 @@ -001 0.61604 -002 0.462721 -003 0.5451 -004 0.724984 -005 0.491232 -006 0.601881 -007 0.708672 -008 0.748101 -009 0.64938 -010 0.718227 -011 0.621901 -012 0.630765 -013 0.638418 -014 0.773358 -015 0.802686 -016 0.460133 -017 0.906494 -018 0.887968 -019 0.478938 -020 0.640308 -021 0.459023 -022 0.488446 -023 0.463613 -024 0.589331 -025 0.851867 -026 0.751316 -027 0.77978 -028 0.730616 -029 0.759855 -030 0.681913 -031 0.633158 -032 0.414212 -033 0.535174 -034 0.487512 -035 0.839059 -036 0.863238 -037 0.555764 -038 0.92374 -039 0.800818 -040 0.777334 -041 0.463772 -042 0.376687 -043 0.477076 -044 0.558871 -045 0.386918 -046 0.602374 -047 0.571063 -048 0.38278 -049 0.642519 -050 0.561415 -051 0.476553 -052 0.91165 -053 0.861286 -054 0.798752 -055 0.674705 -056 0.902441 -057 0.89772 -058 0.65431 -059 0.864944 -060 0.535375 -061 0.550271 -062 0.577639 -063 0.82454 -064 0.852543 -065 0.797661 -066 0.755805 -067 0.623455 -068 0.670823 -069 0.817864 -070 0.864195 -071 0.84222 -072 0.649035 -073 0.0574754 -074 0.645383 -075 0.697487 -076 0.558651 -077 0.827553 -078 0.8708 -079 0.72033 -080 0.683053 -081 0.705858 -082 0.708434 -083 0.595665 -084 0.619222 -085 0.62457 -086 0.931629 -087 0.858439 -088 0.500468 -089 0.467463 -090 0.501135 -091 0.483847 -092 0.43826 -093 0.485071 -094 0.274986 -095 0.564071 -096 0.728724 -097 0.839396 -098 0.852155 -099 0.795094 -100 0.322391 -101 0.98033 -102 0.863465 -103 0.588666 -104 0.724451 -105 0.706728 -106 0.562188 -107 0.701743 -108 0.723693 -109 0.63856 -110 0.658479 -111 0.687025 -112 0.628743 -113 0.858906 -114 0.528551 -115 0.51619 -116 0.775569 -117 0.741227 -118 0.944483 -119 0.516814 -120 0.547556 -121 0.608698 -122 0.852766 -123 0.685216 -124 0.304172 -125 0.8172 -126 0.424369 -127 0.676132 -128 0.663027 -129 0.590442 -130 0.454836 -131 0.486099 -132 0.622399 -133 0.59138 -134 0.716208 -135 0.801198 -136 0.561471 -137 0.40719 -138 0.706038 -139 0.771284 -140 0.0760635 -141 0.602599 -142 0.675558 -143 0.50947 -144 0.615042 -145 0.813707 -146 0.74996 -147 0.73172 -148 0.629152 -149 0.744656 -150 0.846847 -151 0.815818 -152 0.861505 -153 0.901646 -154 0.702821 -155 0.853288 -156 0.850405 -157 0.796257 -158 0.610843 -159 0.678851 -160 0.663142 -161 0.504492 -162 0.763536 -163 0.532158 -164 0.46978 -165 0.487187 -166 0.418694 -167 0.702303 -168 0.474765 -169 0.485866 -170 0.602483 -171 0.632621 -172 0.886557 -173 0.854177 -174 0.890948 -175 0.974374 -176 0.919818 -177 0.673518 -178 0.693199 -179 0.894504 -180 0.790988 -181 0.757293 -182 0.777804 -183 0.637 -184 0.541738 -185 0.524254 -186 0.69556 -187 0.6714 -188 0.678718 -189 0.576306 -190 0.550648 -191 0.814766 -192 0.881064 -193 0.452699 -194 0.833696 -195 0.730816 -196 0.732087 -197 0.144064 -198 0.201785 -199 0.650835 -200 0.374371 -201 0.324886 -202 0.618024 -203 0.692634 -204 0.479762 -205 0.670095 -206 0.879011 -207 0.624398 -208 0.53062 -209 0.633274 -210 0.573458 -211 0.870388 -212 0.286946 -213 0.383 -214 0.312401 -215 0.233976 -216 0.664395 -217 0.509506 -218 0.501634 -219 0.566186 -220 0.590632 -221 0.535605 -222 0.673841 -223 0.807987 -224 0.377279 -225 0.417711 -226 0.697284 -227 0.80817 -228 0.321382 -229 0.375787 -230 0.643796 -231 0.719229 -232 0.755039 -233 0.471431 -234 0.645821 -235 0.895412 -236 0.732042 -237 0.657826 -238 0.613722 -239 0.713664 -240 0.56141 -241 0.676376 -242 0.716088 -243 0.792091 -244 0.164723 -245 0.718651 -246 0.655129 -247 0.683949 -248 0.740855 -249 0.854093 -250 0.456829 -251 0.914585 -252 0.789267 -253 0.710269 -254 0.7234 -255 0.611063 -256 0.566604 -257 0.823418 -258 0.601698 -259 0.60155 -260 0.582725 -261 0.659817 -262 0.729255 -263 0.826714 -264 0.763825 -265 0.888278 -266 0.86649 -267 0.411765 -268 0.825882 -269 0.590593 -270 0.496519 -271 0.702942 -272 0.662457 -273 0.527105 -274 0.620504 -275 0.59948 -276 0.37519 -277 0.287707 -278 0.789535 -279 0.902759 -280 0.939809 -281 0.959133 -282 0.649517 -283 0.767106 -284 0.801517 -285 0.597057 -286 0.85317 -287 0.82493 -288 0.898085 -289 0.525411 -290 0.960731 -291 0.208803 -292 0.715377 -293 0.786548 -294 0.522184 -295 0.620426 -296 0.859654 -297 0.847462 -298 0.490813 -299 0.288598 -300 0.705455 -301 0.867468 -302 0.449862 -303 0.780275 -304 0.760185 -305 0.426203 -306 0.526279 -307 0.73075 -308 0.825481 -309 0.703969 -310 0.660832 -311 0.90071 -312 0.911575 -313 0.619725 -314 0.70883 -315 0.74602 -316 0.721942 -317 0.579722 -318 0.32407 -319 0.807318 -320 0.378056 -321 0.48029 -322 0.838816 -323 0.581801 -324 0.682765 -325 0.645841 -326 0.6022 -327 0.810219 -328 0.602283 -329 0.827242 -330 0.760615 -331 0.643642 -332 0.673486 -333 0.692523 -334 0.914359 -335 0.955059 -336 0.415772 -337 0.843258 -338 0.503932 -339 0.791458 -340 0.285956 -341 0.818555 -342 0.443998 -343 0.758668 -344 0.358909 -345 0.480308 -346 0.675871 -347 0.55059 -348 0.510346 -349 0.753104 -350 0.869479 -351 0.824363 -352 0.712634 -353 0.523015 -354 0.592839 -355 0.407622 -356 0.73202 -357 0.572509 -358 0.833826 -359 0.803023 -360 0.707459 -361 0.27341 -362 0.355935 -363 0.657501 -364 0.686642 -365 0.60321 -366 0.633663 -367 0.593536 -368 0.746509 -369 0.348452 -370 0.682499 -371 0.677044 -372 0.83147 -373 0.653867 -374 0.563534 -375 0.533696 -376 0.53279 -377 0.741491 -378 0.683548 -379 0.623046 -380 0.982893 -381 0.876962 -382 0.384149 -383 0.0902245 -384 0.468595 -385 0.978042 -386 0.618088 -387 0.773515 -388 0.604132 -389 0.457409 -390 0.663174 -391 0.631232 -392 0.945496 -393 0.745585 -394 0.405031 -395 0.262553 -396 0.26931 -397 0.282412 -398 0.481331 -399 0.467715 -400 0.588023 -401 0.430597 -402 0.405649 -403 0.631029 -404 0.612493 -405 0.235459 -406 0.703137 -407 0.813278 -408 0.47046 -409 0.310159 -410 0.731566 -411 0.774646 -412 0.547375 -413 0.501587 -414 0.332024 -415 0.766668 -416 0.71957 -417 0.892119 -418 0.603754 -419 0.545801 -420 0.529458 -421 0.763485 -422 0.60342 -423 0.438932 -424 0.540427 -425 0.571655 -426 0.524227 -427 0.538228 -428 0.53163 -429 0.332848 -430 0.319731 -431 0.605219 -432 0.430523 -433 0.791304 -434 0.255749 -435 0.26677 -436 0.55897 -437 0.636318 -438 0.512233 -439 0.847604 -440 0.839292 -441 0.49433 -442 0.70014 -443 0.476057 -444 0.399648 -445 0.333349 -446 0.422614 -447 0.624587 -448 0.535689 -449 0.740069 -450 0.608923 -451 0.248446 -452 0.517049 -453 0.566172 -454 0.53118 -455 0.734641 -456 0.291408 -457 0.303825 -458 0.763958 -459 0.96865 -460 0.990744 -461 0.286989 -462 0.75966 -463 0.614629 -464 0.416519 -465 0.470169 -466 0.794939 -467 0.372137 -468 0.898987 -469 0.32405 -470 0.901089 -471 0.810771 -472 0.649418 -473 0.548716 -474 0.367984 -475 0.382547 -476 0.488307 -477 0.679651 -478 0.936162 -479 0.543941 -480 0.81938 -481 0.772561 -482 0.780311 -483 0.272122 -484 0.588943 -485 0.291081 -486 0.927366 -487 0.263429 -488 0.677861 -489 0.661622 -490 0.709464 -491 0.364973 -492 0.918656 -493 0.899249 +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 \ No newline at end of file diff --git a/database.py b/database.py index 0fbc7a9..674bdaa 100644 --- a/database.py +++ b/database.py @@ -97,19 +97,17 @@ class Database: 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] - ids = [int(line.split(' ')[0]) for line in lines] - light = [ids[i] for i,v in enumerate(values) if v > threshold] - names = [self.__pokemon_list[i-1] for i in light] - return names if all else random.choice(names) + 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] - ids = [int(line.split(' ')[0]) for line in lines] - dark = [ids[i] for i,v in enumerate(values) if v < threshold] - names = [self.__pokemon_list[i-1] for i in dark] - return names if all else random.choice(names) + 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. From 04f665f970860f79f1ac506788ebcc8ceb0a15e0 Mon Sep 17 00:00:00 2001 From: Griffin Young Date: Sun, 25 Jun 2017 13:07:45 -0700 Subject: [PATCH 6/7] fix help message and name vs id conflict --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index b7c08ce..fb3a0cc 100755 --- a/main.py +++ b/main.py @@ -75,6 +75,8 @@ Other Parameters: slideshow- [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- [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. @@ -232,9 +234,9 @@ def single_argument_handler(arg): elif arg == "dark" and escape_code: change_wallpaper(db, db.get_dark().get_name()) elif arg == "light": - change_terminal_background(db, db.get_light().get_name()) + change_terminal_background(db, db.get_light()) elif arg == "dark": - change_terminal_background(db, db.get_dark().get_name()) + change_terminal_background(db, db.get_dark()) elif arg == "slideshow": slideshow(db, 1, 494) elif arg == "slideshow-kanto": From f21446be6e4c16a8e8044222a98d8694025c5bb7 Mon Sep 17 00:00:00 2001 From: Griffin Young Date: Sun, 25 Jun 2017 15:39:03 -0700 Subject: [PATCH 7/7] fixed light threshold --- database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database.py b/database.py index 674bdaa..de51aa4 100644 --- a/database.py +++ b/database.py @@ -93,7 +93,7 @@ class Database: # Get all the Extra Pokemon images available. return self.__get_region(None) - def get_light(self, threshold=0.6, all=False): + 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]