-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
957 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
language: python | ||
python: | ||
- "3.4" | ||
- "nightly" | ||
matrix: | ||
allow_failures: | ||
- python: "nightly" | ||
fast_finish: true | ||
|
||
# Route build to container-based infrastructure | ||
sudo: false | ||
|
||
# Cache the dependencies installed by pip | ||
cache: pip | ||
# Avoid pip log from affecting cache | ||
before_cache: rm -fv ~/.cache/pip/log/debug.log | ||
|
||
# Install defaults to "pip install -r requirements.txt" | ||
|
||
# Commands that prepare things for the test | ||
before_script: | ||
- export PYTHONPATH=$PYTHONPATH:`pwd -P` | ||
|
||
# The coveralls module on PyPI (1.1) doesn't report branch coverage to | ||
# Coveralls, but should in the next release (1.2) | ||
script: coverage run --branch --source=src -m unittest2 discover --buffer | ||
|
||
after_success: coveralls | ||
|
||
# Prevent 'Video not initialized' errors | ||
env: | ||
SDL_VIDEODRIVER: "dummy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
========== Version 1.1.0 ========== | ||
|
||
New Features and Minor Changes: | ||
|
||
- Add a Stop Button that behaves like the BeeBot Stop Button | ||
|
||
Patches, Bug Fixes and Documentation Changes: | ||
|
||
- Change the Board class to throw exceptions rather than exiting on a size mismatch | ||
- Add Travis CI testing and coverage monitoring | ||
- Replace the text on Buttons with arrows | ||
- Change the default scenario license to reflect the new main repository | ||
- Add an example ScenarioWriter and a README explaining how to use it | ||
- Tweak logo position for narrower scenarios |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pygame | ||
# Dependencies for testing | ||
unittest2 | ||
coveralls | ||
mock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Creating a new scenario | ||
1. Choose a scenario name. It will be referred to below as `<name>`. | ||
|
||
2. Copy `scenarioWriters/scenarioWriterBlank.py` to `scenarioWriters/scenarioWriter<name>.py` | ||
|
||
3. At Line 10 onward, add the following: | ||
``` | ||
# Initialises a new scenario object and sets the scenario name. | ||
scenario = Scenario('<name>') | ||
``` | ||
|
||
* 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. | ||
``` | ||
# The size of an individual square. | ||
scenario.set_board_step(n) | ||
``` | ||
|
||
* 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. | ||
``` | ||
# Sets the width of the map in terms of squares. | ||
scenario.set_logical_width(x) | ||
# Sets the height of the map in terms of squares. | ||
scenario.set_logical_height(y) | ||
``` | ||
|
||
* Decide where you want your `BeeBot` to start. Add the following code, replacing `x, y` with your starting co-ordinates. | ||
``` | ||
# Sets the bee bot starting square. | ||
scenario.set_beebot_start_position(x, y) | ||
``` | ||
|
||
* 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. | ||
``` | ||
# Set the BeeBot sprite. | ||
scenario.set_beebot_sprite('<sprite>') | ||
``` | ||
|
||
* 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. | ||
``` | ||
# Sets the BeeBots starting direction, where "UP" is Heading.NORTH. | ||
# (other options are Heading.EAST, Heading.SOUTH and Heading.WEST) | ||
scenario.set_beebot_heading(<heading>) | ||
``` | ||
|
||
* Set the background image. Add the following code, but replace <background> with the file path of your image. | ||
``` | ||
# Sets the image on the map. | ||
scenario.set_background('<background>') | ||
``` | ||
|
||
* 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. | ||
``` | ||
scenario.set_border_colour((R, G, B)) | ||
``` | ||
|
||
* 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. | ||
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')` | ||
``` | ||
# This line adds an obstacle. | ||
scenario.add_obstacle(x, y) | ||
``` | ||
|
||
* 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. | ||
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')` | ||
``` | ||
# This line adds a goal. | ||
scenario.add_goal(x, y) | ||
``` | ||
|
||
* 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. | ||
``` | ||
# This method means the goals must be met in the order added. | ||
scenario.set_ordered_goals(True) | ||
``` | ||
or | ||
``` | ||
# This method means the goals can be met in any order. | ||
scenario.set_ordered_goals(False) | ||
``` | ||
|
||
* 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. | ||
``` | ||
# Sets the sprite to be displayed when the robot crashes | ||
scenario.set_beebot_fail_sprite('path') | ||
``` | ||
|
||
4. Finally, run `python scenarioWriters/ScenarioWriter<name>.py` to generate your `.scitbot` file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"""This file writes a new scibot file.""" | ||
|
||
from src.Scenario import Scenario | ||
from src.BeeBot import Heading | ||
|
||
|
||
def main(): | ||
"""Write a scibot file.""" | ||
# Add commands below | ||
|
||
# Copy the LICENSE from below into the Scenario | ||
scenario.set_license(LICENSE) | ||
|
||
# Writes the scibot file | ||
scenario.write_to_file() | ||
|
||
# Alter this to credit image sources | ||
LICENSE = """ | ||
GNU GENERAL PUBLIC LICENSE | ||
Version 2, June 1991 | ||
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/> | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
Everyone is permitted to copy and distribute verbatim copies | ||
of this license document, but changing it is not allowed. | ||
The full version of this license can be found here. | ||
https://github.com/stfc/SciBot/blob/master/LICENSE | ||
BeeBot image source. | ||
https://www.tes.co.uk/teaching-resource/bee-bot-sequence-powerpoint-6415227 | ||
""" | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.