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
  1. import scala.util.Random
  2.  
  3.  
  4.  
  5. object MyBot extends App {
  6.     println("bot is running...")
  7.     new AntsGame().run(new MyBot)
  8.     println("bot is finished...")
  9. }
  10.  
  11. class MyBot extends Bot {
  12.  
  13.   def ordersFrom(game: Game): Set[Order] = {
  14.  
  15.     println("bot is making a move...")
  16.     // Your logic goes here.
  17.     // for example ...
  18.  
  19.    
  20.     val directions = List(North, East, South, West)
  21.     val ants = game.board.myAnts.values
  22.     ants.flatMap{ant =>
  23.  
  24. //      while(game.board.water.contains(targetTile)) {
  25. //        direction = Random.shuffle(A.toList).head
  26.   //      targetTile = game.tile(direction).of(ant.tile)
  27.  
  28.         val dirs = Random.shuffle(directions)
  29.         val direction = dirs.find{aim =>
  30.           val targetTile = game.tile(aim).of(ant.tile)
  31.           !game.board.water.contains(targetTile)
  32.         }
  33. //      }
  34.       //ant = Order(ant.tile, d)
  35.       //Order(ant.tile, direction)
  36.       direction.map{d => Order(ant.tile, d)}
  37.      
  38.       // for this ant, find the first direction which is not water, if any
  39.  
  40.       // convert this (possible) direction into an order for this ant
  41.       direction.map{d => Order(ant.tile, d)} */
  42.     }.toSet
  43.   }
  44. }
  45.  

Replies to scala1 rss

Title Name Language When
Re: scala1 Jahu text 1 Year ago.

Reply to "scala1"

Here you can reply to the paste above