Commit Graph

208 Commits (e17c7827378d59c726c3c532ffcb1eeaa72a2d2a)

Author SHA1 Message Date
Nate Smith e17c782737 WIP adding curses 2023-12-09 16:29:49 -08:00
Nate Smith 67676dda8d fore 2023-12-09 16:29:49 -08:00
Nate Smith 673232919b notes 2023-12-09 16:29:49 -08:00
Nate Smith bc843b27cc embark on a journey 2023-12-09 16:29:49 -08:00
Nate Smith ad0d78e133 oops 2023-12-09 16:14:19 -08:00
Nate Smith 26df7b5a1f adjust mutation rarity to account for reduced number of life iterations 2023-12-08 21:42:24 -08:00
Nate Smith 9162888a7d consolidate autosave into life thread 2023-12-06 21:52:40 -08:00
Nate Smith 8d45997537 fix scoping on death_check change even more 2023-12-06 21:38:13 -08:00
Nate Smith 84bb89b48c fix scoping on death_check change more 2023-12-06 21:37:12 -08:00
Nate Smith be770c6b5e fix scoping on death_check change 2023-12-06 21:36:15 -08:00
Nate Smith ed7498bd4a reduce CPU usage dramatically
I noticed that on tilde.town users with a high botany score used up a
lot of CPU cycles. I skimmed through the code and didn't immediately see
any tight loops, but after profiling against a user's borrowed .botany
directory I saw the culprit: the score increase thread.

This thread was designed to increase the user's score by 1 every time
the thread did an iteration of its infinite loop. It would sleep for an
interval scaled *down* based on how high a user's generation bonus was.
This meant that the sleep interval trended towards zero, creating a
tight loop for high scoring users.

This commit changes the code to use a constant sleep inteveral but scale
the score increment *up* based on generation.

I also removed the death check thread entirely since we were already
checking for death in the score thread. I also short circuited the death
check.

This had the effect of reducing CPU load for a high scoring user by a
factor of about 50.
2023-12-06 21:08:43 -08:00
Nate Smith 99c1fda072 ignore *.swp 2023-12-04 22:04:29 -08:00
Nate Smith ea358f641d move Plant to its own module
Without this, trying to run this against cProfiler fails because pickler
can't find Plant in the "current" module. It's an annoying quirk of
pickle+cProfiler.
see: https://stackoverflow.com/questions/53890693/cprofile-causes-pickling-error-when-running-multiprocessing-python-code

this commit also adds a bunch of notes.
2023-12-04 22:04:00 -08:00
nate smith 151a700774 do not import * 2023-12-02 22:31:32 -08:00
Jake Funke 070a880f12
Merge pull request #50 from epif4nio/master
On harvest confirmation message, default to Y when user presses enter
2023-03-21 10:47:44 -07:00
Tiago Epifanio c92b3d3667 Clean other instances of user 2023-03-20 00:26:43 +00:00
Tiago Epifanio c63a186d32 On harvest confirmation message, default to Y when user presses return 2023-03-19 23:51:39 +00:00
Jake Funke bdfb113063
Merge pull request #40 from tilde-team/master
fix visiting
2022-10-12 12:15:42 -07:00
Jake Funke b81516eea5
Merge pull request #46 from McSinyx/py3
Update shebang
2022-10-12 12:15:00 -07:00
Jake Funke c2f00e9b0e
Merge pull request #47 from Huy-Ngo/fix-floating-point
fix precision to first decimal place
2022-10-12 12:14:43 -07:00
Jake Funke 36b6507766
Update README.md 2022-10-12 12:14:17 -07:00
Ngô Ngọc Đức Huy 4ba1d6d46a
fix precision to first decimal place
fix precision to first decimal place to avoid floating-point error
2022-05-20 20:19:05 +07:00
Nguyễn Gia Phong 27b8733bf4
Update shebang 2022-05-13 13:40:23 +09:00
Ben Harris 29369dae13 fix visiting 2021-04-06 15:50:53 -04:00
Jake Funke 38f7f17b66
Merge pull request #34 from jmdejong/evilvisitors
Don't let evil visitors kill a plant by adding old timestamps
2021-01-25 14:19:04 -08:00
Jake Funke d0a9bf22a4
Merge pull request #36 from cosarara/master
don't use "is" to compare string literals
2021-01-25 14:18:39 -08:00
Jake Funke f5dd135c91
Merge pull request #37 from jmdejong/patch-2
Stop making all plants godly
2021-01-25 14:18:17 -08:00
J.M. de Jong 85d51f40f5
Stop making all plants godly
python2 division of integers always results in an integer, so `(2/3)` would result in `0`.
This caused all plants to get "godly" as rarity.
This change makes sure a float division is being used
2021-01-23 14:30:31 +01:00
Jaume Delclòs Coll 729e5268e4 don't use "is" to compare string literals 2020-10-25 02:09:29 +02:00
troido 0556b3f75a protect plants against old timestamps 2020-10-03 09:44:06 +02:00
Jake Funke f243391418
Merge pull request #32 from ChristophGra/master
Error handling when getch() throws an error
2020-09-15 12:15:58 -07:00
Akronymus 979c925234
Error handling when getch() throws an error
Currently untested, but should work well enough. Doing this as an reference implementation.
2020-09-15 19:45:54 +02:00
Jake Funke da33b69be4
Update README.md 2020-04-03 15:14:04 -07:00
Jake Funke 54bcd2fc61
Update README.md 2020-04-03 15:13:18 -07:00
Jake Funke d93c5aad8f
Merge pull request #27 from marado/master
Added info about where the readme actually is
2020-04-03 15:09:18 -07:00
Jake Funke c003d183fd
Merge pull request #28 from marado/view
botany-view: a new binary giving you a snapshot
2020-04-03 15:09:06 -07:00
Jake Funke a0be5be6bc
Merge pull request #29 from marado/patch-1
making the halloween easter egg ~-agnostic
2020-04-03 15:08:55 -07:00
Jake Funke ea92373f37
Merge pull request #24 from PaperMountainStudio/python3
Use python3
2020-04-03 14:55:10 -07:00
Marcos Marado c44f9a1ed1
making the halloween easter egg ~-agnostic 2020-04-03 00:47:18 +01:00
Marcos Marado 34d1f1be2e botany-view: a new binary giving you a snapshot
python botany-view.py will give you a snapshot look of your garden plot,
showing what is in there. Instead of an interactive curses interface, it
just shows you your plant as it currently is. It's like just taking a
peek through the window, or a picture of your plant to show to your
friends.
2020-04-02 15:35:57 +01:00
Marcos Marado 2b9cc31b17 Added info about where the readme actually is
The help menu points out to the readme for more info, but, in cases
where people are using this because it is installed on their server, but
they weren't the ones getting it from the web, they probably don't know
where to find that README. It might not happen to many people, but it
happened to me :-)

This patch just adds another line, with the URL for the README.
2020-04-02 00:03:05 +01:00
Paper Mountain Studio c089f8fe67 delete old import for python2 2020-01-14 17:21:21 +01:00
Jake Funke 595a4d7e31 found an oopsie 2019-10-30 23:53:56 +00:00
Paper Mountain Studio 58ac0d3250 Use python3 2019-10-30 18:27:45 +01:00
Jake Funke a38c64914f clarify growth rate 2019-08-26 16:34:08 +00:00
Jake Funke 9d7c5966d3 cleanup comments 2019-08-16 17:25:45 +00:00
Jake Funke 9bb1f74f74 fix harvest numeric input bug 2019-08-16 17:21:40 +00:00
Jake Funke 8fd35a5927 logic tweak 2019-02-28 00:41:15 +00:00
Jake Funke 300b9e8d00 Added alpine-like q to quit 2018-12-13 22:54:57 +00:00
Jake Funke 70d02db493
Merge pull request #22 from midnightpupil/master
changed shebang to increase portability @ahriman/tilde.town
2018-12-06 17:11:53 -08:00