Hello, Everybody:

If you like Minecraft and Go, you may like project Malmo 
<https://www.microsoft.com/en-us/research/project/project-malmo/> and the 
GoWrapper I have been working on (https://github.com/cpmech/malmo forked 
from here <https://github.com/Microsoft/malmo>).

For example, a minimal code to command Steve (he will run like a crazy 
person...) is given below (see more examples here 
<https://github.com/cpmech/malmo/tree/master/Malmo/samples/Go_examples>):

package main

import (
        "fmt"
        "malmo"
        "math/rand"
        "os"
        "time"
)

func main() {

        agent_host := malmo.NewAgentHost()
        defer agent_host.Free()

        err := agent_host.Parse(os.Args)
        if err != nil {
                fmt.Println(err)
                return
        }

        my_mission := malmo.NewMissionSpec()
        defer my_mission.Free()

        my_mission_record := 
malmo.NewMissionRecordSpecTarget("/tmp/saved_data.tgz")
        defer my_mission_record.Free()

        err = agent_host.StartMissionSimple(my_mission, my_mission_record)
        if err != nil {
                fmt.Println(err)
                return

        }

        fmt.Println("Waiting for the mission to start")
        for {
                fmt.Print(".")
                time.Sleep(100 * time.Millisecond)
                world_state := agent_host.GetWorldState()
                if world_state.HasMissionBegun {
                        break
                }
        }
        fmt.Println()

        for {
                agent_host.SendCommand("move 1")
                agent_host.SendCommand(fmt.Sprintf("turn %d", rand.Int()*2-1))
                time.Sleep(500 * time.Millisecond)
                world_state := agent_host.GetWorldState()
                if !world_state.IsMissionRunning {
                        break
                }
        }
        fmt.Println("Mission has stopped.")
}


Installation instructions for Ubuntu are here: 
build_ubuntu_minimal_python_and_golang.md 
<https://github.com/cpmech/malmo/blob/master/doc/build_ubuntu_minimal_python_and_golang.md>

It should work on Windows and macOS too.

Have (lots of) fun!
Cheers.
Dorival

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to