Need help getting a Nim Bot to run on the server


#1

I’ve written my own bot in the Nim language.

I’ve have an install.sh script that installs nim, and then compiles the bot. I’ve successfully tested the script on an Unbutu server. When uploading to Halite, after the successful compilation messages, I’m see the following error message,

Did not find a recognized MyBot.* file. Please add one of the following filenames to your zip file: Ada: MyBot.adb C++: CMakeLists.txt C: MyBot.c C#/.NET Core: MyBot.csproj C#/Mono: MyBot.cs VB/Mono: MyBot.vb C++: MyBot.cpp Clojure: project.clj CoffeeScript: MyBot.coffee D: MyBot.d Dart: MyBot.dart Elixir: mix.exs Erlang: my_bot.erl F#/.NET Core: MyBot.fsproj Forth: MyBot.fs Go: MyBot.go Groovy: MyBot.groovy Haskell: MyBot.hs Haskell/Stack: stack.yaml Java: MyBot.java JavaScript: MyBot.js JAR: MyBot.jar Julia: MyBot.jl Kotlin: MyBot.kt Lisp: MyBot.lisp Lua/LuaJIT: MyBot.lua Lua/Lua5.3: MyBot.lua53 OCaml: MyBot.ml Octave: MyBot.m Pascal: MyBot.pas Perl: MyBot.pl PHP: MyBot.php Python: MyBot.py Python (PyPy): MyBot.pypy Racket: MyBot.rkt Ruby: MyBot.rb Rust: Cargo.toml Scala: MyBot.scala Scheme: MyBot.ss Swift: Package.swift Tcl: MyBot.tcl

What do I need to do? I do have MyBot.nim file in the zip.

my install.sh file:

#!/bin/bash
mkdir tools
cd tools
curl -O https://nim-lang.org/download/nim-0.19.0.tar.xz
tar -xJf nim-0.19.0.tar.xz
cd nim-0.19.0/
sh build.sh
cd ../..
tools/nim-0.19.0/bin/nim compile -d:release MyBot.nim
rm -rf tools/nim-0.19.0

#2

Because I love lame ugly hacks, I wrote a javascript wrapper that launches my bot.

This seems to work well locally, but the build process is being marked as failed on the halite server even though it seems to succeed according to the debugging echo’s I’ve added to install.sh.

The trailing end of the compile step failure email from Halite says:

....
* Finished bot build
* ls output:
  LANGUAGE MyBot MyBot.js MyBot.nim ai.nim atc.nim engine.nim greetings greetings.nim install.sh log.nim tools
* Finished file

End of install.sh stdout. 

Which is exactly what I should be seeing. I see the built MyBot file. The stderr report looks good too. What is the build process looking for that is not finding?


#3

So install.sh is marked as failing if there is any output on stderr. (For example, running curl).

My new install.sh file looks like this:

#!/bin/bash
mkdir tools
cd tools
curl -O https://nim-lang.org/download/nim-0.19.0.tar.xz 2>&1
tar -xJf nim-0.19.0.tar.xz
cd nim-0.19.0/
sh build.sh 2>&1
cd ../..
echo "* Starting bot build"
tools/nim-0.19.0/bin/nim compile -d:release greetings.nim 2>&1
echo "* Finshed bot build"
echo `ls`
rm -rf tools
echo "* Finished file"

And works fine posing as javascript.


#4

Nim isn’t installed on the Halite server environment so it won’t work.


#5

To be clear, I’m now successfully running my Nim bot on the server.


#6

We’ll roll Nim and Kotlin into the next worker OS image: https://github.com/HaliteChallenge/Halite-III/issues/146