/* abc */
using System;
using System.Collections.Generic;
class Cell{
public int x;
public int y;
public int color;
}
class Game{
List<Cell> cells;
List<System.Func<Cell,Cell,bool>> predicates;
public Game(){
predicates = new List<System.Func<Cell,Cell,bool>>();
predicates.Add( delegate(Cell a,Cell b){ return ( b.x - a.x == 0); });
predicates.Add( delegate(Cell a,Cell b){ return ( b.y - a.y == 0); });
predicates.Add(
delegate(Cell a,Cell b){
return (
( (b.x - a.x == 0) && (b.y - a.y == 0)) ||
(
(b.x - a.x != 0 ) &&
(
(double)(b.y - a.y) / (b.x - a.x) == 1
)
)
);
}
);
predicates.Add(
delegate(Cell a,Cell b){
return (
( (b.x - a.x == 0) && (b.y - a.y == 0)) ||
(
(b.x - a.x != 0 ) &&
(
(double)(b.y - a.y) / (b.x - a.x) == -1
)
)
);
}
);
cells = new List<Cell>();
for(int j = 0;j < 5; j++){
for(int i = 0;i < 5; i++){
Cell cell = new Cell();
cell.x = i;
cell.y = j;
cell.color = 0;
cells.Add(cell);
}
}
Test();
}
public void Test(){
List<Evaluator> elist = new List<Evaluator>();
cells.ConvertAll(
delegate(Cell c1){
return predicates.ConvertAll(
delegate(System.Func<Cell,Cell,bool> f1){
return new Evaluator(c1,f1);
}
);
}
).ForEach(
delegate(List<Evaluator> elist1){
elist.AddRange(elist1);
}
);
List<List<Cell>> x1 = elist.ConvertAll(
delegate(Evaluator e){
return cells.FindAll(e.GetResult);
}
);
List<List<Cell>> x2 = new List<List<Cell>>();
x1.ForEach(
delegate(List<Cell> list1){
if(
x2.FindAll(
delegate(List<Cell> list2){
return (list1.Count == list2.Count) &&
(list1.TrueForAll(delegate(Cell c){ return list2.Contains(c);}));
}
).Count == 0
){
x2.Add(list1);
}
}
);
x2.ForEach(
delegate(List<Cell> testlist){
System.Console.WriteLine(
String.Concat(
testlist.ConvertAll(
delegate(Cell c1){
return "(" + c1.x.ToString() + "," + c1.y.ToString() + ")";
}
)
)
);
}
);
}
}
class Evaluator{
Cell c = null;
System.Func<Cell,Cell,bool> f = null;
public Evaluator(Cell c1,System.Func<Cell,Cell,bool> f1){
c = c1;
f = f1;
}
public bool GetResult (Cell c1){
return f(c,c1);
}
}
class HOGE{
public static void Main(){
Game g = new Game();
}
}
LyogYWJjICovCgp1c2luZyBTeXN0ZW07Cgp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKCmNsYXNzIENlbGx7CgoJcHVibGljIGludCB4OwoKCXB1YmxpYyBpbnQgeTsKCglwdWJsaWMgaW50IGNvbG9yOwoKfQoKY2xhc3MgR2FtZXsKCglMaXN0PENlbGw+IGNlbGxzOwoKCUxpc3Q8U3lzdGVtLkZ1bmM8Q2VsbCxDZWxsLGJvb2w+PiBwcmVkaWNhdGVzOwoKCXB1YmxpYyBHYW1lKCl7CgogCgoJCXByZWRpY2F0ZXMgPSBuZXcgTGlzdDxTeXN0ZW0uRnVuYzxDZWxsLENlbGwsYm9vbD4+KCk7CgoJCXByZWRpY2F0ZXMuQWRkKCBkZWxlZ2F0ZShDZWxsIGEsQ2VsbCBiKXsgIHJldHVybiAoIGIueCAtIGEueCA9PSAwKTsgfSk7CgoJCXByZWRpY2F0ZXMuQWRkKCBkZWxlZ2F0ZShDZWxsIGEsQ2VsbCBiKXsgIHJldHVybiAoIGIueSAtIGEueSA9PSAwKTsgfSk7CgoJCXByZWRpY2F0ZXMuQWRkKCAKCgkJCQkJCWRlbGVnYXRlKENlbGwgYSxDZWxsIGIpewoKCQkJCQkJCXJldHVybiAoCgoJCQkJCQkJCQkJKCAoYi54IC0gYS54ID09IDApICYmIChiLnkgLSBhLnkgPT0gMCkpIHx8IAoKCQkJCQkJCQkJCSgKCgkJCQkJCQkJCQkJKGIueCAtIGEueCAhPSAwICkgJiYKCgkJCQkJCQkJCQkJKAoKCQkJCQkJCQkJCQkJKGRvdWJsZSkoYi55IC0gYS55KSAvIChiLnggLSBhLngpID09IDEKCgkJCQkJCQkJCQkJKQoKCQkJCQkJCQkJCSkKCgkJCQkJCQkpOwoK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kJcmV0dXJuICIoIiArIGMxLnguVG9TdHJpbmcoKSArICIsIiArIGMxLnkuVG9TdHJpbmcoKSArICIpIjsKCgkJCQkJCQkJCQkJCX0KCgkJCQkJCQkJCQkpCgoJCQkJCQkJCSkKCgkJCQkJCSk7CgoJCQkJfQoKCQkpOwoKCX0KCn0KCmNsYXNzIEV2YWx1YXRvcnsKCglDZWxsIGMgPSBudWxsOwoKCVN5c3RlbS5GdW5jPENlbGwsQ2VsbCxib29sPiBmID0gbnVsbDsKCglwdWJsaWMgRXZhbHVhdG9yKENlbGwgYzEsU3lzdGVtLkZ1bmM8Q2VsbCxDZWxsLGJvb2w+IGYxKXsKCgkJCWMgPSBjMTsKCgkJCWYgPSBmMTsKCgl9CgogCXB1YmxpYyBib29sIEdldFJlc3VsdCAoQ2VsbCBjMSl7CgoJCQlyZXR1cm4gZihjLGMxKTsKCgl9Cgp9CgpjbGFzcyBIT0dFewoKCQlwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpewoKCQkJCUdhbWUgZyA9IG5ldyBHYW1lKCk7CgoJCX0KCn0=
prog.cs(235,38): warning CS0219: The variable `g' is assigned but its value is never used
Compilation succeeded - 1 warning(s)
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]
System.Collections.Generic.List`1[System.String]