/army/hwh/fm_box.erl

http://erlbattle.googlecode.com/ · Erlang · 56 lines · 52 code · 3 blank · 1 comment · 0 complexity · d8d91d5e91050af8d8a4a5632ab8eaae MD5 · raw file

  1. -module(hwh.fm_box).
  2. -compile(export_all).
  3. %%{ID, X, Y}
  4. type(triangle2) ->
  5. .io:format("triangle2~n", []),
  6. [
  7. {1, 0, 2},
  8. {2, 1,3},
  9. {3, 2,4},
  10. {4, 1,5},
  11. {5, 0,6},
  12. {6, 0,7},
  13. {7, 1,8},
  14. {8, 2,9},
  15. {9, 1,10},
  16. {10, 0,11}
  17. ];
  18. type(double_w) ->
  19. .io:format("double_w~n", []),
  20. [
  21. {1, 1, 2},
  22. {2, 0, 3},
  23. {3, 1, 4},
  24. {4, 0, 5},
  25. {5, 1, 6},
  26. {6, 1, 7},
  27. {7, 0, 8},
  28. {8, 1, 9},
  29. {9, 0, 10},
  30. {10, 1, 11}
  31. ];
  32. type(crane) ->
  33. .io:format("crane~n", []),
  34. [
  35. {1, 3, 2},
  36. {2, 2, 3},
  37. {3, 1, 4},
  38. {4, 0, 5},
  39. {5, 1, 6},
  40. {6, 1, 7},
  41. {7, 0, 8},
  42. {8, 1, 9},
  43. {9, 2, 10},
  44. {10, 3, 11}
  45. ];
  46. type(random) ->
  47. L = [triangle2, double_w, crane],
  48. N = .random:uniform(length(L)),
  49. type(.lists:nth(N, L));
  50. type(random2) ->
  51. L = [triangle2, double_w, crane, triangle2, double_w, crane],
  52. N = .random:uniform(length(L)),
  53. type(.lists:nth(N, L)).