2024-02-07
Goal
Twitch Stream the development of the Django API.
Notes
HitHub App
I figured it was more important to get the API up and running to start making the key component, the Fights App. Now that the Fighters App is pretty much all set up, we'll need a way to actually simulate fights between our different fighters. I don't want fights to be executed by my server itself, so I'd like it to be done by a call to AWS Lambda. To make communication between the Lambda script and my fighters' data easier I want to use the djangorestframework package (a package that makes it easy to implement the Django API).
First, I found the script where I had simulated fights in the past, it can be found here:
C:\Users\Billy\Documents\HitHub\Game\fight_simulator.ipynb
I use a Fight
Class to simulate a fight in the Fights App.
I actually ended up getting distracted with the viability of the current Fights App simulator. The roll function was wildly inefficient (creating an entire Beta Distribution using the Probability Density Function). I adjusted it to instead just use numpy to sample a random point and reduced the overall simulation time from ~30 seconds to about 3. Yikes. Oh well you live and you learn.
I also wanted to account for the difference in skill level somehow when rolling and updating a fighters' priors. There are two options I've been considering:
1) Take the difference in score between the two beta distributions and use that small value to increment the fighter's priors 2) If the disadvantaged fighter gets lucky and happens to achieve something that is difficult, they get a significant boost to that prior (indicating they've been undervalued as a fighter)
Actually finding out how to account for this will need to involve both updating my dataset (it's old, last scraped in 2021 I think) as well as analyzing general trends of how fighters' stats change over time. It doesn't have to be exact, but it will be fun to analyze and model if it's closer to the real world stats. Who knows, might actually end up giving me an advantage in some markets.
DIMMiN App
After work I quickly fixed the About App's missing side image by adding it to the static common files. Since it's not actually in the about page (rather, the home page) I decided to just leave it in the common files instead of the Static Files of the about app. This was an easy fix and could be pushed to Production in about 10 minutes.
I wanted to work on Spending Waaaaaaaaaaaay Too Much Time at Bars but got a little distracted again (that seems to be happening more than usual). I also added a category section to the Blog App to reference the categories at the bottom of the page. There's a bit of a pull between working on developing the site and actually writing content for the site that I'll need to balance. There are tons of ideas that I have for it which may actually warrant its own app within DIMMiN... Yeah I'm gonna make an app for it.
The birth of the BigBrain App
I used the startapp
command to create the BigBrain App via
python manage.py startapp bigbrain
Then I added two Django Models:
Idea
for ideas that I can play around with and think up on the fly, andProject
for descriptions of different projects I know I have going on
I made these changes and pushed them to Production. I got a 500 Response Error but thankfully ChatGPT saved the day when it said I could use the Heroku CLI to apply Database Migrations to fix the problem. I used it to log into Bash via the
heroku run bash --app dimmin
command, then ran
python manage.py makemigrations
to actually migrate the database and add the necessary tables for the Idea
and Project
models. For now I just want to be able to list out all of my projects and maybe sort them by their priorities and deadlines. I don't know if I want to make a more involved front-end version like Taskmaster App but that might become necessary to help me prioritize these things. I may just be procrastinating by creating this new thing, but I think this kind of tool (similar to task app) will help me organize all of the projects I have going on. It might also be a convenient place to build / schedule / hold Floaty Notes data.
Either way I finished today by adding different projects I have going on to my new BigBrain App.
Results
- HitHub App
- Fixed up Fights App's overly-complicated sampling system
- Started to re-think the fight simulator's prior update system
- DIMMiN App
- Created the BigBrain App with its different Django Models
- Started adding a couple of projects I've been neglecting ahaaaa
Next Time
- One of the following
- HitHub App
- Start working on djangorestframework implementation to add Django API functionality to the app
- Start researching how to update priors / store data in the Fights App simulation
- Start collecting updated data for the
SpiritFighter
s
- DIMMiN App
- Get back to writing Spending Waaaaaaaaaaaay Too Much Time at Bars
- Organize all possible projects you have going on via the BigBrain App
- HitHub App
^ My preference might be for the last one so I don't keep getting pulled away from these different projects