- import scala.util.Random
- object MyBot extends App {
- println("bot is running...")
- new AntsGame().run(new MyBot)
- println("bot is finished...")
- }
- class MyBot extends Bot {
- def ordersFrom(game: Game): Set[Order] = {
- println("bot is making a move...")
- // Your logic goes here.
- // for example ...
- val directions = List(North, East, South, West)
- val ants = game.board.myAnts.values
- ants.flatMap{ant =>
- // while(game.board.water.contains(targetTile)) {
- // direction = Random.shuffle(A.toList).head
- // targetTile = game.tile(direction).of(ant.tile)
- val dirs = Random.shuffle(directions)
- val direction = dirs.find{aim =>
- val targetTile = game.tile(aim).of(ant.tile)
- !game.board.water.contains(targetTile)
- }
- // }
- //ant = Order(ant.tile, d)
- //Order(ant.tile, direction)
- direction.map{d => Order(ant.tile, d)}
- // for this ant, find the first direction which is not water, if any
- // convert this (possible) direction into an order for this ant
- direction.map{d => Order(ant.tile, d)} */
- }.toSet
- }
- }
scala1
From Jahu, 1 Year ago, written in Plain Text, viewed 2 times.
This paste will expire in 1 Second.
URL https://paste.paivola.fi/view/3c47a36b
Embed
Download Paste or View Raw
— Expand Paste to full width of browser