Skip to content

Instantly share code, notes, and snippets.

@dumbmatter
dumbmatter / Blob.stream-polyfill.js
Created October 19, 2021 17:07
Polyfill for Blob.stream
if (!Blob.prototype.stream) {
Blob.prototype.stream = function () {
let offset = 0;
const chunkSize = 64 * 1024;
const blob = this;
return new ReadableStream({
pull(controller) {
return new Promise((resolve) => {
@dumbmatter
dumbmatter / player-mood.md
Last active September 9, 2020 01:28
BBGM player moods documentation draft

First, I want to be clear... player mood only affects contract negotiation. There is no "team chemistry" or "player is upset so he plays worse"... yet :)

Additionally, I am aware of concerns about micromanagement. I don't want it to be essential to micromanage this stuff. If you want to ignore player moods, you probably can get away with it without suffering too much. If your team is successful, players will want to play for you. In a big market? Even better. That gets you most of the way there. It's not like "players who want to play in a big market will only play in a big market" or "players who want to win will only play for an established title contender" - in addition to not being fun, that wouldn't be very realistic either. You can also disable player mood traits in God Mode, if you want.

With that out of the way, take a look at the UI for the new mood system, from your roster page:

...

There are 3 things you see are their mood score, mood traits, and probability they will be willing to re-s

@dumbmatter
dumbmatter / draft-names-countries-colleges.md
Last active July 26, 2020 01:38
Draft of documentation for new format of names, colleges, and countries data in BBGM custom league files
layout title
page
Customizing Player Names, Countries, and Colleges

One of the game attributes you can customize is called "playerBioInfo". This lets you specify how biographical information is generated for players, specifically their names, countries, and colleges.

By default, Basketball GM includes a pretty large library of all of those, and picks them in proportion so that random leagues feel realistic. But if you want to simulate a different type of league, such as in a different country, then the defaults are no good.

Player Names

@dumbmatter
dumbmatter / how.md
Created May 9, 2018 20:51
How to fix 0 ovr/pot ratings in some players in Basketball GM

First, open your league in Chrome. Then open a new tab and go to this URL: chrome://inspect/#workers - that should show something like "https://play.basketball-gm.com/gen/worker-2018.05.05.1163.js" with an "Inspect" link under it. Click "Inspect". That will open a new window where you can run commands. In that window, run this (copy/paste the whole block of code at once, and then press enter):

bbgm.idb.league.tx("players", "readwrite", tx => tx.players.iterate(p => {
    let update = false;
    for (const ratings of p.ratings) {
        if (isNaN(ratings.oiq) || isNaN(ratings.diq)) {
            update = true;
            break;
        }

}

@dumbmatter
dumbmatter / germany.json
Created February 11, 2018 14:25
BBGM with only German Players
{
"gameAttributes": [
{
"key": "names",
"value": {
"first": {
"Germany": [
["Alex", 1],
["Alexander", 2],
["Amar", 3],
@dumbmatter
dumbmatter / BBGM 2002 League File
Last active May 16, 2016 00:42
What I did to make this: 1. created new league on https://play.basketball-gm.com/ ; 2. exported league (just players and teams); 3. opened the file in a text editor and did search/replace to change 2015 to 2002; 4. added "startingSeason": 2002, after the first line.
{
"startingSeason": 2002,
"meta": {
"phaseText": "2002 preseason",
"name": "League 3"
},
"players": [
{
"tid": -1,
"statsTids": [],
from pylab import *
from scipy.stats import *
num_adults = 227e6
basic_income = 7.25*40*50
labor_force = 154e6
disabled_adults = 21e6
current_wealth_transfers = 3369e9
def jk_rowling(num_non_workers):
@dumbmatter
dumbmatter / bbgm-stack-acronym.py
Created December 22, 2014 01:54
Origins of the KIRK HINRICH stack used to build http://basketball-gm.com/
scores = {}
words = {}
with open('letters.csv') as f:
for line in f:
letter, word, score = line.rstrip().split(',')
scores[letter] = int(score)
words[letter] = word
names = []