Advertisement
Guest User

clem

a guest
Jun 17th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. // lib/openxum-core/games/emergo/engine.mjs
  2.  
  3. import OpenXum from '../../openxum/index.mjs';
  4. //import les autres classes dont vous avez besoin
  5.  
  6. class Engine extends OpenXum.Engine {
  7. constructor(t, c) {
  8. super();
  9. this._type = t;
  10. this._current_color = c;
  11.  
  12. // autres attributs nécessaires à votre jeu
  13. }
  14.  
  15. build_move() {
  16. return new Move();
  17. }
  18.  
  19. clone() {
  20. let o = new Engine(this._type, this._current_color);
  21.  
  22. o._attribute = this._attribute;
  23. // ...
  24. return o;
  25.  
  26. // TODO
  27. }
  28.  
  29. current_color() {
  30. return this._current_color;
  31. //TODO
  32.  
  33. }
  34.  
  35. get_name() {
  36. return 'Newgame';
  37.  
  38. // TODO
  39. }
  40.  
  41. get_possible_move_list() {
  42. // TODO
  43. }
  44.  
  45. is_finished() {
  46. // TODO
  47. }
  48.  
  49. move(move) {
  50. if (move.get_type() === MoveType.PUT_PIECE) {
  51. this._put_piece(move);
  52. } if (move.get_type() === MoveType.MOVE_STACK) {
  53. this._move_piece(move);
  54. }
  55. }
  56.  
  57.  
  58. parse(str) {
  59. // TODO
  60. }
  61.  
  62. to_string() {
  63. // TODO
  64. }
  65.  
  66. winner_is() {
  67. // TODO
  68. }
  69. }
  70.  
  71. export default Engine
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement