PageRenderTime 106ms CodeModel.GetById 97ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

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