4 ms·
Yeah, output right in the notebook is important. I'm wanting them to be able to do something like this in a cell: for ship in myShip.radarScan(): i
by danielvf 9y ago
Yeah, output right in the notebook is important. I'm wanting them to be able to do something like this in a cell:
for ship in myShip.radarScan():
if ship.is_enemy:
display([ship.type, ship.range, ship.bearing])
And then have that cells results always showing the current data as they play the game.
- Tenoke 9y agoI haven't used it much, but I believe you can do this by using (or more likely slightly extending) the init_cell nbextension. https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/init_cell/README.html https://jupyter-contrib-nbextensions.readthedocs.io/en/lates...
- danielvf 9y agoOh, that's cool - it's just some javascript that's essentially clicking execute on the selected cells. That makes sense, and hacked up version of this could work fine! Thanks!
- po84 9y ago> And then have that cells results always showing the current data as they play the game. display handles that you can update from elsewhere in the notebook might be of interest. Here's an example: https://github.com/ipython/ipython/blob/master/examples/IPython%20Kernel/Updating%20Displays.ipynb https://github.com/ipython/ipython/blob/master/examples/IPyt...