public override void Visit(PlayLoopNode node) { Console.Write("play ("); node.Player.Accept(this); Console.Write(" vs "); node.Opponents.Accept(this); Console.Write(" in "); node.AllPlayers.Accept(this); Console.Write(")"); node.PlayLoopBody.Accept(this); Console.Write(" until ("); node.UntilCondition.Accept(this); Console.Write(");"); }
public override void Visit(PlayLoopNode node) { int local = IndentationLevel; CSharpString.Append("{"); IndentationLevel++; CSharpString.Append("List<" + node.Player.Type); // Checks whether the type is a struct and adds the _ after the type if it is if (!IsPrimitiveType(node.Player.Type)) { CSharpString.Append("_"); } CSharpString.Append("> AllElements" + local + " = new List<" + node.Player.Type); if (!IsPrimitiveType(node.Player.Type)) { CSharpString.Append("_"); } CSharpString.Append(">();"); PrettyPrintNewLine(); CSharpString.Append(node.Player.Type); if (!IsPrimitiveType(node.Player.Type)) { CSharpString.Append("_"); } CSharpString.Append(" "); node.Player.Accept(this); CSharpString.Append(";"); PrettyPrintNewLine(); CSharpString.Append("List<" + node.Player.Type); if (!IsPrimitiveType(node.Player.Type)) { CSharpString.Append("_"); } CSharpString.Append(">"); node.Opponents.Accept(this); CSharpString.Append(" = new List<" + node.Player.Type); if (!IsPrimitiveType(node.Player.Type)) { CSharpString.Append("_"); } CSharpString.Append(">();"); PrettyPrintNewLine(); CSharpString.Append("do"); PrettyPrintNewLine(); CSharpString.Append("{"); IndentationLevel++; PrettyPrintNewLine(); CSharpString.Append("AllElements" + local + " = "); node.AllPlayers.Accept(this); CSharpString.Append(";"); PrettyPrintNewLine(); CSharpString.Append("for (int i = 0; i < AllElements" + local + ".Count; i++)"); PrettyPrintNewLine(); IndentationLevel++; CSharpString.Append("{"); IndentationLevel++; PrettyPrintNewLine(); node.Player.Accept(this); CSharpString.Append(" = AllElements" + local + "[i];"); PrettyPrintNewLine(); node.Opponents.Accept(this); CSharpString.Append(" = AllElements" + local + ".Where((x, j) => j != i).ToList();"); node.PlayLoopBody.Accept(this); IndentationLevel--; CSharpString.Append("}"); PrettyPrintNewLine(); IndentationLevel--; CSharpString.Append("} while (!("); node.UntilCondition.Accept(this); CSharpString.Append("));"); IndentationLevel--; CSharpString.Append("}"); IndentationLevel--; }
internal abstract void Visit(PlayLoopNode node);
public abstract void Visit(PlayLoopNode node);