diff options
author | Emile <hanemile@protonmail.com> | 2020-02-22 16:03:18 +0100 |
---|---|---|
committer | Emile <hanemile@protonmail.com> | 2020-02-22 16:03:18 +0100 |
commit | 3ed43806e9254d070484b8a267b2379bfddde91b (patch) | |
tree | deb086d52ef0038e2ead9a00b36c01868f91d06d /src | |
parent | edea1ed7b790810558fa6acd697676b577e1f2a0 (diff) |
functions run during the competition
Diffstat (limited to 'src')
-rw-r--r-- | src/run.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/run.go b/src/run.go new file mode 100644 index 0000000..1149c41 --- /dev/null +++ b/src/run.go @@ -0,0 +1,34 @@ +package main + +import ( + "fmt" + "strings" + + "github.com/radare/r2pipe-go" +) + +func stepIn(r2p *r2pipe.Pipe) string { + _ = r2cmd(r2p, "aes") + registers := r2cmd(r2p, "aerR") + registersStripped := strings.Replace(registers, "\n", ";", -1) + return registersStripped +} + +func switchPlayer(currentPlayer int, config Config) int { + return (currentPlayer + 1) % len(config.Bots) +} + +func user(r2p *r2pipe.Pipe, id int, registers string, config Config) string { + var res string + + // res += "\x1b[2J\x1b[0;0H" + res += fmt.Sprintf("USER %d\n", id) + res += fmt.Sprintf("%s\n", r2cmd(r2p, "aer")) + res += "+++\n" + res += fmt.Sprintf("%s\n", r2cmd(r2p, fmt.Sprintf("%s %d @ 0\n", "prx", config.Memsize))) + res += "+++\n" + //res += r2cmd("pxw 32 @r:SP") + "\n" + //res += r2cmd("pD %d @ %s"%(size[uidx], orig[uidx])) + + return res +} |