Last active
December 14, 2015 21:29
-
-
Save distributedlife/5151529 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define(['cricket/server_player', 'lib/event_emitter'], function(ServerPlayer, EventEmitter) { | |
| "use strict"; | |
| return function(fielding_ai, bowling_ai, batting_ai) { | |
| var _this = new ServerPlayer(); | |
| _this.init = function() { | |
| _this.typename = "ai"; | |
| EventEmitter.call(_this); | |
| fielding_ai.call(_this); | |
| }; | |
| _this.init(); | |
| return _this; | |
| }; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define(['cricket/terms'], function(Terms) { | |
| "use strict"; | |
| var fielding_ai = function(slice) { | |
| function set_field(field) { | |
| field.mad_logic(); | |
| this.emit_event('player/over/set_field/complete'); | |
| } | |
| return function() { | |
| this.set_field = set_field; | |
| return this; | |
| }; | |
| }([].slice); | |
| return fielding_ai; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function some_codez(ai, field) { | |
| ai.set_field(field); | |
| } | |
| //Uncaught TypeError: Cannot call method 'emit_event' of undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment