# # matlab-link.m # matlab-link # # Created by Daniel Axtens on 28/07/10. # Licensed under an MIT-style license: see the LICENSE file for details. # # You don't need to read this file. All you need to do is take agent-template.m # and fill it in with your own functions. This file does all the I/O for you, # and matlab-consts.m defines useful utilities and constants. # # Do not depend on the contents of this file. It may be changed for speed, security # or other reasons and your bot may break if you depend on it. You have been warned. in = input("","s"); while ( !strcmp( "BYE", in ) ) splitIn = strsplit( in, " " ); switch splitIn{1} case "ATTACK" [attack, bluff] = Attack( splitIn{2} ); disp( [ "ATTACKING ", rps.itemToString{attack}, " ", \ rps.itemToString{bluff} ] ); case "DEFEND" defence = Defend( splitIn{2}, stringToItem(splitIn{3}) ); disp( [ "DEFENDING ", rps.itemToString{defence} ] ); case "RESULTS" Results( splitIn{2}, strcmp( splitIn{3}, "True" ), splitIn{4}, \ stringToItem(splitIn{5}), stringToItem(splitIn{6}), \ stringToItem(splitIn{7}), str2num(splitIn{8}) ); disp( "OK" ); endswitch fflush(stdout); fflush(stderr); in = input("","s"); endwhile