~namark/snail

snail/snail.cpp -rw-r--r-- 1.5 KiB View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include <iostream>
#include "simple/geom/vector.hpp"

using simple::geom::vector;

int main()
{
	// auto shell = vector(
	// 	vector(1,2,3),
	// 	vector(4,5,6),
	// 	vector(7,8,9)
	// );

	// auto shell = vector(
	// 	vector(1),
	// 	vector(2)
	// );

	// auto shell = vector(
	// 	vector(1,2)
	// );

	// auto shell = vector(
	// 	vector(1)
	// );

	// auto shell = vector(
	// 	vector<int,0>()
	// );

	// auto shell = vector(
	// 	vector<int,0>(),
	// 	vector<int,0>(),
	// 	vector<int,0>(),
	// 	vector<int,0>()
	// );

	// auto shell = vector<vector<int,10>,0>{};

	// auto shell = vector(
	// 	vector(1,2),
	// 	vector(3,4)
	// );

	// auto shell = vector(
	// 	vector( 1, 2, 3, 4),
	// 	vector( 5, 6, 7, 8),
	// 	vector( 9,10,11,12)
	// );

	// auto shell = vector(
	// 	vector( 1, 2, 3),
	// 	vector( 4, 5, 6),
	// 	vector( 7, 8, 9),
	// 	vector(10,11,12)
	// );

	auto shell = vector(
		vector( 1, 2, 3, 4),
		vector( 5, 6, 7, 8),
		vector( 9,10,11,12),
		vector(13,14,15,16)
	);

	auto size = decltype(shell)::meta::dimensions<int>;
	auto direction = 1;
	auto begin = vector(-1,0);
	while(size > vector(0,0))
	{
		auto end = begin + direction * (size - vector(0,1)) ;

		do
		{
			begin.x() += direction;
			std::cout << begin << " - " << shell[begin] << '\n';
		}
		while(begin.x() != end.x());
		while(begin.y() != end.y())
		{
			begin.y() += direction;
			std::cout << begin << " - " << shell[begin] << '\n';
		}
		//do

		--size;
		direction = -direction;
	}

	return 0;
}