This file contains hidden or 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.Text; | |
var helloWorld = new HelloWorld(); | |
helloWorld.WriteLine(Console.Out); | |
/* Output: Hello, World! */ | |
public sealed class HelloWorld:CursedQueue<char> { | |
public HelloWorld() { | |
_ = 'H'; _ = 'e'; _ = 'l'; _ = 'l'; _ = 'o'; _ = ','; _ = ' '; | |
_ = 'W'; _ = 'o'; _ = 'r'; _ = 'l'; _ = 'd'; _ = '!'; |
This file contains hidden or 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
public readonly struct @object { | |
private readonly object value; | |
private @object(object value) => this.value = value; | |
public bool HasValue => value != null; | |
public object _ => value; | |
public static implicit operator bool (@object value) => value.HasValue; | |
public static implicit operator @object (int value) => new @object(value); |
This file contains hidden or 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
use std::fs::File; | |
use std::io::{self, prelude::*, BufReader}; | |
const TEST_WORD: &str = "pears"; //The word to check for anagrams of, should be changed to program arguments instead of a constant | |
const FILE_NAME: &str = "words_alpha.txt"; //A file containing new line delimited words list with alpha characters only | |
const ALPHABET: &str = "abcdefghijklmnopqrstuvwxyz"; //The English 26 character alphabet | |
const ALPHABET_SIZE: usize = ALPHABET.len(); | |
const LOOKUP_ORDER: [usize; ALPHABET_SIZE] = [ | |
//Allows for faster dictionary processing due to the letter frequency of the English language |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
static const char* DICTIONARY_FILE = "C:\\Users\\Samuel\\Documents\\c-shit\\words_alpha.txt"; | |
static const int ALPHABET_SIZE = 26; | |
static const int ALPHABET_ORDER[] = { | |
//Conforms to "etaoinshrdlcumwfgypbvkjxqz" | |
//(There's probably a way to generate this data at compile time within the source file?) | |
2,19,11,9,0,15,16,7,4,22,21,10,13,5,3,18,24,8,6,1,12,20,14,23,17,25 |
This file contains hidden or 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
const money = function() { | |
const cent = "¢"; | |
const addCents = (base,amount) => { | |
for(let i = 0;i<amount;i++) { | |
base += cent; | |
} | |
return base; | |
} | |
let cents = ""; | |
let debt = ""; |
This file contains hidden or 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
const topRacePositions = 3; | |
const maxHorseRaceCount = 5; | |
const horseCount = 25; | |
/* | |
The numberical constants are very hard-coded into this problem and the algorithm itself. | |
It could be reworked into making it work with other numbers of horses, | |
but the requirement of 25 is that 5 horses per race is also the | |
the square root of 25 in the first place. |