Metadata-Version: 2.1
Name: swoggle
Version: 0.0.4
Summary: My implementation of our made up game
Home-page: https://github.com/johnowhitaker/swoggle
Author: Jonathan Whitaker
Author-email: johnowhitaker@gmail.com
License: Apache Software License 2.0
Keywords: swoggle
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.6
Description-Content-Type: text/markdown

<!--

#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: index.ipynb
# command to build the docs after a change: nbdev_build_docs

-->

# Title

> summary


# Swoggle Game Engine

Implements a silly game we invented last Christmas and have been playing recently.

Rules are TODO.

## Install (Not on pip yet!!)

`pip install swoggle`

## How to use

To get a board with the basic setup, use the swoggle class:
<div class="codecell" markdown="1">
<div class="input_area" markdown="1">

```python
s = Swoggle(agents=[])
s.show()
```

</div>
<div class="output_area" markdown="1">

    [1.1][...][...][...][...][...][...][4.4]
    [...][...][...][...][...][...][...][...]
    [...][...][...][...][.d.][...][...][...]
    [...][...][.d.][...][...][...][...][...]
    [...][...][...][...][...][.d.][...][...]
    [...][...][...][.d.][...][...][...][...]
    [...][...][...][...][...][...][...][...]
    [2.2][...][...][...][...][...][...][3.3]
    Spa: []


</div>

</div>

Players can move (after rolling a dice). For example, player 1 could move to the square with a drone:
<div class="codecell" markdown="1">
<div class="input_area" markdown="1">

```python
s.move(1, (0, 0), (3, 2), 5) # Only works if dice_roll is high enough
s.show()
```

</div>
<div class="output_area" markdown="1">

    Moved 1 (0, 0) (3, 2)
    [..1][...][...][...][...][...][...][4.4]
    [...][...][...][...][...][...][...][...]
    [...][...][...][...][.d.][...][...][...]
    [...][...][1d.][...][...][...][...][...]
    [...][...][...][...][...][.d.][...][...]
    [...][...][...][.d.][...][...][...][...]
    [...][...][...][...][...][...][...][...]
    [2.2][...][...][...][...][...][...][3.3]
    Spa: []


</div>

</div>

You can move with the drone, but only half as far:
<div class="codecell" markdown="1">
<div class="input_area" markdown="1">

```python
s.move(1, (3, 2), (1, 1), 5, drone=True) # Only works if dice_roll is high enough
s.show()
```

</div>
<div class="output_area" markdown="1">

    Moved 1 (3, 2) (1, 1)
    [..1][...][...][...][...][...][...][4.4]
    [...][1d.][...][...][...][...][...][...]
    [...][...][...][...][.d.][...][...][...]
    [...][...][...][...][...][...][...][...]
    [...][...][...][...][...][.d.][...][...]
    [...][...][...][.d.][...][...][...][...]
    [...][...][...][...][...][...][...][...]
    [2.2][...][...][...][...][...][...][3.3]
    Spa: []


</div>

</div>

You can leave the drone behind to move elsewhere. But you cannot take an occupied base without the drone:
<div class="codecell" markdown="1">
<div class="input_area" markdown="1">

```python
s.move(1, (1, 1), (7, 0), 6) # No drone - no luck
```

</div>
<div class="output_area" markdown="1">

    Invalid Move 1 (1, 1) (7, 0)


</div>

</div>

You can take a droned player with a drone for yourself or a powerjump:
<div class="codecell" markdown="1">
<div class="input_area" markdown="1">

```python
s.move(1, (1, 1), (4, 0), 6, drone=True) # Put 1 in position
s.move(2, (7, 0), (4, 0), 6, powerjump=True) # take one with a powerjump
s.show()
```

</div>
<div class="output_area" markdown="1">

    Moved 1 (1, 1) (4, 0)
    Player 1 sent to Swoggle Spa
    Drone destroyed
    Moved 2 (7, 0) (4, 0)
    [..1][...][...][...][...][...][...][4.4]
    [...][...][...][...][...][...][...][...]
    [...][...][...][...][.d.][...][...][...]
    [...][...][...][...][...][...][...][...]
    [2..][...][...][...][...][.d.][...][...]
    [...][...][...][.d.][...][...][...][...]
    [...][...][...][...][...][...][...][...]
    [..2][...][...][...][...][...][...][3.3]
    Spa: [1]


</div>

</div>

Now player 1 must try to escape, by rolling a 5 ot 6
<div class="codecell" markdown="1">
<div class="input_area" markdown="1">

```python
s.move(1, (0, 0), (0, 0), 4) # No escape with a 4
s.move(1, (0, 0), (0, 0), 5) # Escaped
s.show()
```

</div>
<div class="output_area" markdown="1">

    Player 1 did not escape
    Player 1 escaped
    [1.1][...][...][...][...][...][...][4.4]
    [...][...][...][...][...][...][...][...]
    [...][...][...][...][.d.][...][...][...]
    [...][...][...][...][...][...][...][...]
    [2..][...][...][...][...][.d.][...][...]
    [...][...][...][.d.][...][...][...][...]
    [...][...][...][...][...][...][...][...]
    [..2][...][...][...][...][...][...][3.3]
    Spa: []


</div>

</div>
<div class="codecell" markdown="1">
<div class="input_area" markdown="1">

```python
s.move(1, (0, 0), (4, 0), 6) # Capture 2
s.move(1, (4, 0), (7, 0), 5) # Take 2's base to win the game
s.show()
```

</div>
<div class="output_area" markdown="1">

    Player 2 sent to Swoggle Spa
    Moved 1 (0, 0) (4, 0)
    Player 1 defeated player 2
    Moved 1 (4, 0) (7, 0)
    [1.1][...][...][...][...][...][...][4.4]
    [...][...][...][...][...][...][...][...]
    [...][...][...][...][.d.][...][...][...]
    [...][...][...][...][...][...][...][...]
    [...][...][...][...][...][.d.][...][...]
    [...][...][...][.d.][...][...][...][...]
    [...][...][...][...][...][...][...][...]
    [...][...][...][...][...][...][...][3.3]
    Spa: []


</div>

</div>

# Adding agents

We have several agents to choose from. Let's create a game with 2 random agents and 2 basic agents and watch them play:
<div class="codecell" markdown="1">
<div class="input_area" markdown="1">

```python
sr = Swoggle([RandomAgent(i+1) for i in range(2)]+[BasicAgent(i+3) for i in range(2)])
sr.show()
```

</div>
<div class="output_area" markdown="1">

    [1.1][...][...][...][...][...][...][4.4]
    [...][...][...][...][...][...][...][...]
    [...][...][...][...][.d.][...][...][...]
    [...][...][.d.][...][...][...][...][...]
    [...][...][...][...][...][.d.][...][...]
    [...][...][...][.d.][...][...][...][...]
    [...][...][...][...][...][...][...][...]
    [2.2][...][...][...][...][...][...][3.3]
    Spa: []


</div>

</div>
<div class="codecell" markdown="1">
<div class="input_area" markdown="1">

```python
# Run repeatedly to see a game play out
sr.move_agents()
sr.show()
```

</div>
<div class="output_area" markdown="1">

    Moved 3 (6, 1) (7, 0)
    Player 4 defeated player 3
    Moved 4 (1, 6) (7, 7)
    [...][...][...][...][...][...][...][4.4]
    [...][...][...][...][...][...][...][...]
    [...][...][...][...][.d.][...][...][...]
    [...][...][.d.][...][...][...][...][...]
    [...][...][...][...][...][.d.][...][...]
    [...][...][...][.d.][...][...][...][...]
    [...][...][...][...][...][...][...][...]
    [...][...][...][...][...][...][...][...]
    Spa: []


</div>

</div>

# Where Next?

The point of this exercise was to 1) Learn NBev and 2) Get a gae ready for RL experiments. So far so good :)


