This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.IO; | |
namespace Caesar | |
{ | |
static class Program | |
{ | |
static void Main(string[] args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pageContent = new System.Net.WebClient().DownloadString("https://msdn.microsoft.com/en-us/library/x53a06bb.aspx"); | |
var keywords = new Regex(@".aspx"">(\w+)</a>").Matches(pageContent).Cast<Match>() | |
.Select(m => m.Groups[1].Value).OrderBy(s => s).ToList(); | |
var rand = new Random(); | |
var poem = string.Join("\n", | |
Enumerable.Range(0, 3).Select(l => String.Join(" ", | |
Enumerable.Range(0, rand.Next(1, 5)) | |
.Select(w => keywords[rand.Next(keywords.Count)])))); | |
poem.Dump(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static LinkedTree<SExpNode> BuildTree(string literal, params LinkedTree<SExpNode>[] subNodes) | |
{ | |
var node = new LinkedTree<SExpNode>(new SExpNode() { Literal = literal }); | |
foreach (var subNode in subNodes) | |
{ | |
node.AddSubNodeLast(subNode); | |
} | |
return node; | |
} |