This will be a collection of utilities for the web game The Final Outpost, related to genetics and breeding. Currently I have only created a Punnett Square calculator function to determine the possible outcome of breeding hybrids that can be imported into Google Sheets.
From within your Google Sheet, click the "Extensions" menu, then "Apps Script". Create a new project and call it "TFO Punnett Square Calculator". Then replace the text of Code.gs with the contents of the punnett_calculator.gs file in this repository by selecting all the code and copy-pasting it into Google Apps Script. Click "Deploy", then "New Deployment". Click the gear next to "Select Type" and select "Library". Give it a description, such as "TFO Punnett Square Calculator" and click "Deploy".
Inside a cell that you wish to contain the probability of a research goal, type =PUNNETT(
, then select the cells with the genotype of each parent for your desired trait (for example "AabbCC" and "aaBbCc") followed by a cell containing your goal genotype. Separate the selected cells with commas and finish with a )
. It should look something like =PUNNETT(K3,K5,K2)
in the formula bar at the top. It will work with monohybrid, dihybrid, and trihybrid crosses and returns a probability as a decimal that the last value, your goal genotype, will be inherited. To format the cell as a percentage, select it and then click the "Format" menu, and select "Number" -> "Percent".
UPDATE: Please obtain the newest version of the code, it makes use of JsDoc and provides autocomplete when you start typing the function name with documentation like so:
In my spreadsheet, I have a separate sheet for each breeding goal, with two important tables. One is the table listing each creature with all of their traits and my research goal at the top. Here is a screenshot from my Nokta Voko log:
The second important table is the breeding predictions table. It has a row for each potential breeding pair and the results of a Punnett Square calculation for each trait. This is where you would use my PUNNETT
utility function. Here is an example of my Nokta breeding table:
You may choose to add a column that averages all the percentages to give you a general idea which pairs to breed to reach your goal, using the AVERAGE
function. I don't have this column for my Noktas yet because none of my pairings are very viable for reaching my goal.
If you have feedback or questions you can contact me at rio.savvii@gmail.com.