Skip to content

katsel/informatica-scala-2016-follow-up

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scala-Workshop: Follow Up

1. Starting Point

The bot implementation of the Scala Basic Workshop had some drawbacks:

  • it only knew about 'W' (Walls) and was not aware of other entities (such as good and bad plants, good and bad beasts)
  • it got trapped easily by certain wall constellations and could not escape

2. Follow up Exercise

2.1 Energy Saving Bot

Our aim is to implement an energy saving bot. It should become aware of the other entities in its surrounding and try to eat good things to gain energy, while avoiding bad things that draw energy.

The different kinds of plants and beasts, aka entities, are documented in the Scalatron Game Rules and Protocol.

The implementation uses abstract classes and case classes to categorize the kinds of fields a bot can encounter in its surrounding. Combined with matchers, these provide the opportunity to decide on a moving strategy.

2.2 Optional Tasks/Ideas

Optional tasks were:

  • to find out how to escape from room-like wall-fragments ✅
  • use Mini-Bots ❎
  • try out strategies ❎ (requires Mini-Bots)
  • change Scalatron server parameters ❎

3. Outcome

4. How to run the bot (see also: bot development README)

Given that you've already setup your JVM, Scala and sbt installation, these are the commands required to run the bot.

In the project's root directory, run sbt test to run all tests. Then run sbt deploy to compile the bot code.

The Scalatron game server can be started with

./server/bin/startScalatronServer.sh

Enjoy!

5. Explanation of the strategy

  • The bot keeps a global state with its moving direction. Its moving direction can be changed in order to react properly to entities on the game board.
  • When finding a Zugar or Fluppet in its surrounding, the bot changes its moving direction to collect it.
  • The bot tries to avoid walls, Toxiferae and Snorgs. When finding one (or more) of these in its current moving direction, it randomly chooses a free cell to move into, resulting in a random change in moving direction.
  • Because this moving direction change is done at random, the bot can usually escape room-like wall fragments in just a few steps.

References

About

🤖 Follow-up exercises for the Scala workshop held at Informatica feminale 2016

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published