On 01-11-11 16:35, Neil Van Dyke wrote:
> Paulo J. Matos wrote at 11/01/2011 10:57 AM:
>> Anyone working on a Racket starter package for the Ants Google
>> Challenge? http://aichallenge.org/ 
> 
> Here's the documentation they point one to for writing your their
> starter pack:
> https://github.com/aichallenge/aichallenge/wiki/Ants-Starter-Pack-Guide
> https://github.com/aichallenge/aichallenge/wiki/Ant-bot-input-output
> 
> It looks easy to implement.
> 
> Also, I think that, as important as having a Racket starter kit
> available, is having a contestant team that will use the starter kit to
> put in a serious effort.
> 
> A team is a good idea, because you can develop different approaches in
> parallel, and then decide which approaches to combine and refine.  You
> might also be able to use additional people to get generic ``AI''
> libraries working in parallel, separate from their application-specific
> use of those libraries.
> 
> More importantly, remember: it is not enough for Racket programmers to
> merely win; Java programmers must lose.

Currently it looks like C/C++/Java is all there is at the top...
Attached some racket code that implements a do-nothing-bot that passes
the minimal test from the tools. Should be simple to convert to a
starter-kit.

Marijn
#lang racket

;;; multi-dimensional arrays
(require srfi/25)

(define-syntax-rule
  (call-with-hash function hash keys ...)
  (function (car (hash-ref hash 'keys)) ...))

(define (end-turn port)
  (displayln "go" port)
  (flush-output port) )

(define (main)
  (define setup-data (parse-turn-data (read-turn-data "ready" 
(current-input-port))))
  (define bot
    (call-with-hash create-bot setup-data
                    turntime
                    rows cols
                    turns
                    viewradius2 attackradius2 spawnradius2
                    player_seed))
  (displayln setup-data (current-error-port))
  (end-turn (current-output-port))
  (let loop ()
    (let ((data (parse-turn-data (read-turn-data "go" (current-input-port)))))
      (if (hash-has-key? data 'end)
          (begin (end-turn (current-output-port))
                 (displayln data (current-error-port)))
          (begin (end-turn (current-output-port))
                 (displayln data (current-error-port))
                 (loop)))))
  )

(define (read-turn-data end-string port)
  (let loop ((ret '()))
    (let ((line (read-line port)))
      (if (string=? line end-string)
          ret
          (loop (cons line ret))))))

(define (parse-turn-data data)
  (make-immutable-hash
   (map (lambda (datum)
          (let ((split-datum (regexp-split " +" datum)))
            (cons (string->symbol (car split-datum)) (map string->number (cdr 
split-datum)))))
        data)))

(define (create-bot turntime rows cols turns viewradius2 attackradius2 
spawnradius2 player_seed)
  (define terrain (make-array (shape 0 rows 0 cols)))
  #t
)  

(main)

Attachment: signature.asc
Description: OpenPGP digital signature

_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to