<!--
###########################################################################################
This is a JSFiddle example of "Cacatoo". This HTML page does not contain the code itself,
but determines where the grids, graphs, buttons, etc are placed. The real code is in the
Javascript Tab. I recommend enabling "Tabs (Columns)" under the settings in the top-right.
###########################################################################################
-->
<html>
<script src="https://bramvandijk88.github.io/cacatoo/scripts/cacatoo.js"></script>
<script src="https://bramvandijk88.github.io/cacatoo/scripts/all.js"></script>
<!-- Dependencies
<link rel="stylesheet" href="style.css"> <!-- Set style sheet -->
<head>
<title>Cacatoo examples</title>
</head>
<script>
/*-------------------------End user-defined code ---------------------*/
</script>
<body onload="cacatoo()">
<div class="header" id="header">
<h2>Cacatoo (example project)</h2>
</div>
<div class="content" id="canvas_holder"> </div>
<div class="content" id="form_holder"></div>
<div class="content" id="graph_holder"> </div>
<div class="footer" id="footer"></div>
<div class="output" id="output"></div>
</body>
</html>
/*-----------------------Start user-defined code ---------------------*/
let sim
var draw_cells = 1
// Phage parameters
var mu_phage_bitstrings = 0.001
var diff_rate_phages = 0.5
var burst_size = 10 // number of particles created upon infection
var burst_size_cost = 0 // for every extra tail-fiber, reduce burst size with this much
var max_phage_decay = 0.02 // phage decay is maximal in the bottom of the grid
var min_phage_decay = 0.0001 // minimal decay
var phage_influx = 0.0 // influx chance per grid point
var mu_tailfibers = 0.001 // add or remove a tail fiber
// Host level parameters
var N = 1000
var mu_host = 0.001
var uptake = 0.5
var host_birthrate = 0.02
var deathrate = 0.005
// Lock-and-key parameters
var bitstring_length = 100
var lock_and_key_length = 8 // Note: make sure phage-generalism is capped to bitstring_length/lock_and_key_length!!
var max_infection_chance = 0.1
var max_food_influx = 0.01
var food_decay = 0.99
function cacatoo() {
let simconfig = {
title: "Phage-host coevolution with bitstrings", // The name of your cacatoo-simulation
description: "Does resource abundance predict phage host-range? (project proposed by Bas Dutilh)", // And a description if you wish
maxtime: 200000, // How many time steps the model continues to run
// (note, the onscreen FPS may drop below 60 fps when using fast mode, although many more timesteps may be handled per second)
ncol: 80, // Number of columns (width of your grid)
nrow: 100, // Number of rows (height of your grid)
scale: 4, // Scale of the grid (nxn pixels per grid point)
sleep: 0,
wrap: [false, false],
graph_update: 50,
graph_interval: 10,
fpsmeter: false,
}
// FLOCKCONFIG EXAMPLE
// This example sets up a boid simulation with specific values for the currently implemented parameters
// Note however, all these parameters have defaults, so not all need to be set by the user.
let flockconfig...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.