Skip to content

Commit 1e5986d

Browse files
committed
Merge branch 'release-1.1.0'
2 parents 08eea8f + aa99235 commit 1e5986d

23 files changed

Lines changed: 957 additions & 90 deletions

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,23 @@ img/UV/
22
img/UV/*
33
img/SKA/
44
img/SKA/*
5+
img/DataHunt/
6+
img/DataHunt/*
7+
img/GAIA/
8+
img/GAIA/*
59

610
logo.png
711

812
scenarios/UV.scibot
913
scenarios/SKA.scibot
14+
scenarios/Default.scibot
15+
scenarios/DataHunt.scibot
16+
scenarios/GAIA.scibot
1017

1118
scenarioWriters/ScenarioWriterUV.py
1219
scenarioWriters/ScenarioWriterSKA.py
20+
scenarioWriters/ScenarioWriterDataHunt.py
21+
scenarioWriters/ScenarioWriterGAIA.py
1322

1423
scenarios.zip
1524

.travis.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
language: python
2+
python:
3+
- "3.4"
4+
- "nightly"
5+
matrix:
6+
allow_failures:
7+
- python: "nightly"
8+
fast_finish: true
9+
10+
# Route build to container-based infrastructure
11+
sudo: false
12+
13+
# Cache the dependencies installed by pip
14+
cache: pip
15+
# Avoid pip log from affecting cache
16+
before_cache: rm -fv ~/.cache/pip/log/debug.log
17+
18+
# Install defaults to "pip install -r requirements.txt"
19+
20+
# Commands that prepare things for the test
21+
before_script:
22+
- export PYTHONPATH=$PYTHONPATH:`pwd -P`
23+
24+
# The coveralls module on PyPI (1.1) doesn't report branch coverage to
25+
# Coveralls, but should in the next release (1.2)
26+
script: coverage run --branch --source=src -m unittest2 discover --buffer
27+
28+
after_success: coveralls
29+
30+
# Prevent 'Video not initialized' errors
31+
env:
32+
SDL_VIDEODRIVER: "dummy"

CHANGELOG

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
========== Version 1.1.0 ==========
2+
3+
New Features and Minor Changes:
4+
5+
- Add a Stop Button that behaves like the BeeBot Stop Button
6+
7+
Patches, Bug Fixes and Documentation Changes:
8+
9+
- Change the Board class to throw exceptions rather than exiting on a size mismatch
10+
- Add Travis CI testing and coverage monitoring
11+
- Replace the text on Buttons with arrows
12+
- Change the default scenario license to reflect the new main repository
13+
- Add an example ScenarioWriter and a README explaining how to use it
14+
- Tweak logo position for narrower scenarios

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
# SciBot
2+
[![Build Status](https://travis-ci.org/stfc/SciBot.svg?branch=develop)](https://travis-ci.org/stfc/SciBot)
3+
[![Coverage Status](https://coveralls.io/repos/github/stfc/SciBot/badge.svg?branch=develop)](https://coveralls.io/github/stfc/SciBot?branch=develop)
4+
25
contact: scibot-dev@googlegroups.com
36

4-
##Users
5-
1. Go to https://github.com/gregcorbett/SciBot/releases/latest
7+
## Users
8+
1. Go to https://github.com/stfc/SciBot/releases/latest
69
2. Download runSciBot.exe and scenarios.zip into the same place
710
3. Unzip scenarios.zip
811
3. Run the .exe file (by double clicking it.)
912

10-
##Developers
13+
## Developers
1114

12-
Download the soucre.zip, unzip it and navigate to the source code directory
15+
If you wish to develop for SciBot, clone the repository and create a feature branch off of develop. Once your feature is ready, make a Pull Request back into develop.
1316

14-
###Requirements for building and developing SciBot
17+
### Requirements for building and developing SciBot
1518

16-
Microsoft installers have been linked for each requirement for easy of installation.
19+
Microsoft installers have been linked for each requirement for ease of installation.
1720

1821
1. Python, 3.4 or higher (https://www.python.org/downloads/)
1922
* exact version used in testing ( https://www.python.org/ftp/python/3.4.3/python-3.4.3.msi)
@@ -22,11 +25,11 @@ Microsoft installers have been linked for each requirement for easy of installat
2225
3. py2exe 0.9.2.2 (https://pypi.python.org/pypi/py2exe/)
2326
* exact version used in testing (https://pypi.python.org/packages/any/p/py2exe/py2exe-0.9.2.2.win32.exe)
2427

25-
###Building the exe file
28+
### Building the exe file
2629

2730
After the requirements above are met, open a command line and navigate to the unzipped directory.
2831

2932
Run `python setup.py py2exe`.
3033

31-
##Image Sources
34+
## Image Sources
3235
SciBot image sourced from: https://www.tes.co.uk/teaching-resource/bee-bot-sequence-powerpoint-6415227

requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pygame
2+
# Dependencies for testing
3+
unittest2
4+
coveralls
5+
mock

scenarioWriters/README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Creating a new scenario
2+
1. Choose a scenario name. It will be referred to below as `<name>`.
3+
4+
2. Copy `scenarioWriters/scenarioWriterBlank.py` to `scenarioWriters/scenarioWriter<name>.py`
5+
6+
3. At Line 10 onward, add the following:
7+
```
8+
# Initialises a new scenario object and sets the scenario name.
9+
scenario = Scenario('<name>')
10+
```
11+
12+
* Decide how big you want each square to be, in terms of pixels. If you already have a `BeeBot` image (or `Obstacle` images/`Goal` images), your squares should be the same size as this. Add the following code, but replace `n` with your number.
13+
```
14+
# The size of an individual square.
15+
scenario.set_board_step(n)
16+
```
17+
18+
* Decide how many squares you want your map to be. If you already have a background image, this will dictate the height and width. Add the following code, but replace `x` and `y` with your width and height in terms of squares.
19+
```
20+
# Sets the width of the map in terms of squares.
21+
scenario.set_logical_width(x)
22+
# Sets the height of the map in terms of squares.
23+
scenario.set_logical_height(y)
24+
```
25+
26+
* Decide where you want your `BeeBot` to start. Add the following code, replacing `x, y` with your starting co-ordinates.
27+
```
28+
# Sets the bee bot starting square.
29+
scenario.set_beebot_start_position(x, y)
30+
```
31+
32+
* Set your `BeeBot` sprite, it needs to be the same size as your squares. Add the following code, but replace `<sprite>` with the file path of your image.
33+
```
34+
# Set the BeeBot sprite.
35+
scenario.set_beebot_sprite('<sprite>')
36+
```
37+
38+
* You will need to tell the program which way you’re `BeeBot` sprite is facing, where 'UP' is `Heading.NORTH`. Add the following code, but replace <heading> with your heading.
39+
```
40+
# Sets the BeeBots starting direction, where "UP" is Heading.NORTH.
41+
# (other options are Heading.EAST, Heading.SOUTH and Heading.WEST)
42+
scenario.set_beebot_heading(<heading>)
43+
```
44+
45+
* Set the background image. Add the following code, but replace <background> with the file path of your image.
46+
```
47+
# Sets the image on the map.
48+
scenario.set_background('<background>')
49+
```
50+
51+
* If the image has no grid, one can be added by adding the following code and replacing `(R, G, B)` with your chosen RGB colour.
52+
```
53+
scenario.set_border_colour((R, G, B))
54+
```
55+
56+
* Obstacles, squares to avoid, need to be defined separately. To add an `Obstacle`, add the following code, but replace `x, y` with your `Obstacle` location.
57+
To add an `Obstacle` with an image, replace `x, y` with your `Obstacle` location and the file path of the image e.g. `(1, 2, './img/Default/obstacle1.jpg')`
58+
```
59+
# This line adds an obstacle.
60+
scenario.add_obstacle(x, y)
61+
```
62+
63+
* Goals, squares to reach, need to be defined separately also. To add a `Goal`, add the following code, but replace `x, y` with your `Goal` location.
64+
To add a `Goal` with an image, replace `x, y` with your `Goal` location and the file path of the image e.g. `(1, 2, './img/Default/goal1.jpg')`
65+
```
66+
# This line adds a goal.
67+
scenario.add_goal(x, y)
68+
```
69+
70+
* You can decide whether you want your goals to be completed in the order added, or in any order. Add one of the following blocks of code.
71+
```
72+
# This method means the goals must be met in the order added.
73+
scenario.set_ordered_goals(True)
74+
```
75+
or
76+
```
77+
# This method means the goals can be met in any order.
78+
scenario.set_ordered_goals(False)
79+
```
80+
81+
* You'll need to set a sprite for when your BeeBot crashes. Add the following code, but replace `path` with the file path of the image.
82+
```
83+
# Sets the sprite to be displayed when the robot crashes
84+
scenario.set_beebot_fail_sprite('path')
85+
```
86+
87+
4. Finally, run `python scenarioWriters/ScenarioWriter<name>.py` to generate your `.scitbot` file.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""This file writes a new scibot file."""
2+
3+
from src.Scenario import Scenario
4+
from src.BeeBot import Heading
5+
6+
7+
def main():
8+
"""Write a scibot file."""
9+
# Add commands below
10+
11+
# Copy the LICENSE from below into the Scenario
12+
scenario.set_license(LICENSE)
13+
14+
# Writes the scibot file
15+
scenario.write_to_file()
16+
17+
# Alter this to credit image sources
18+
LICENSE = """
19+
GNU GENERAL PUBLIC LICENSE
20+
Version 2, June 1991
21+
22+
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
23+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24+
Everyone is permitted to copy and distribute verbatim copies
25+
of this license document, but changing it is not allowed.
26+
27+
The full version of this license can be found here.
28+
https://github.com/stfc/SciBot/blob/master/LICENSE
29+
30+
BeeBot image source.
31+
https://www.tes.co.uk/teaching-resource/bee-bot-sequence-powerpoint-6415227
32+
"""
33+
34+
if __name__ == "__main__":
35+
main()

scenarioWriters/ScenarioWriterDefault.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def main():
6969
of this license document, but changing it is not allowed.
7070
7171
The full version of this license can be found here.
72-
https://github.com/gregcorbett/SciBot/blob/master/LICENSE
72+
https://github.com/stfc/SciBot/blob/master/LICENSE
7373
7474
BeeBot image source.
7575
https://www.tes.co.uk/teaching-resource/bee-bot-sequence-powerpoint-6415227

scenarios/Default.scibot

-7 Bytes
Binary file not shown.

src/BeeBot.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ def __init__(self, scenario):
5656

5757
# Store MOVE_BEEBOT_* events here.
5858
self.memory = []
59+
self.index = 0
60+
61+
self.running = False
5962

6063
def move(self, event):
6164
"""Move the BeeBot."""
@@ -77,11 +80,11 @@ def add_to_memory(self, event):
7780
self.memory.append(event)
7881

7982
def push_out_memory(self):
80-
"""Act out the instructions in the BeeBot's "memory"."""
81-
for instruction in self.memory:
82-
# we use pygame's event queue because we need to check
83-
# it regularly to prevent the game from crashing.
84-
pygame.event.post(instruction)
83+
"""Act out one instruciton in the BeeBot's "memory"."""
84+
# If memory is not empty
85+
if self.memory != []:
86+
pygame.event.post(self.memory[self.index])
87+
self.index += 1
8588

8689
def clear_memory(self):
8790
"""Clear the BeeBot's "memory"."""

0 commit comments

Comments
 (0)