Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Code-golf is a competition to solve a particular problem in the fewest bytes of source code.
3
votes
Manage a pie shop!
C# - 571 568 559
Bringing up the rear as usual with the hopelessly verbose C#.
using C=System.Console;class Z{static void Main(){var P=new
System.Collections.Generic.Dictionary<string,int>();int i= …
2
votes
Simulate a battle between two creatures
C# - 464 453 chars
After a couple of nights on this I can't seem to get even close to the other entries (not that surprising for C#). Still room for improvement I suspect. No especially clever tricks …
1
vote
Converting a string to lower-case (without built-in to-lower functions!)
C# - 108
class P{static void Main(string[]a){foreach(var c in a[0])System.Console.Write(
(char)(c>64&&c<91?c+32:c));}}
About 70 for just the method body.
Add 5 chars to include a LF/CR in the outp …
0
votes
Decode Chess Move
C# .NET console app, 333 bytes
Assumes using System; using System.Text.RegularExpressions;
string m=Regex.Replace(args[0],"(?<!x)[a-h](?!.*[x|a-h])","t${0}"),r=m[0]>96?"Pawn ":m[0]<49?(m.Length>4?"lon …
3
votes
"99 Bottles of Beer"
C#, 274 bytes
Direct copy from my answer on another question (it was popularity, but I just treated it as golf). Never did get around to golfing it further.
class
P{static
void Main(){
for(int i=99; …
5
votes
Print a tongue twister!
C# (Visual C# Interactive Compiler), 154 bytes
Write(@"S{0}sea{1} by the {2},
The {1} s{0}are sea{1}, I'm sure.
So if s{0}sea{1} on the {2},
Then I'm sure s{0}{2} {1}.","he sells ","shells","seashore …
0
votes
Look and say sequence
C# - 209
using System.Linq;class P{static void Main(){int i='a',N='b'-i,O=i-i,
x=O;var C=N+"";while(i++<'u'){System.Console.WriteLine(C);var n="";(C+
" ").Aggregate((c,d)=>{x++;if(d!=c){n+=x+""+c;x=O …
0
votes
Play a game of memory
C#, 132 bytes
Wanted to keep working on this (ideally finding a smarter algorithm) but never did, so here's where I got up to 3 weeks ago. I just started with a naïve algorithm and golfed it.
string d …
3
votes
Generate a right triangle
C# - 195
using System;class P{static void Main(string[]a){int G=int.Parse(
a[0]),O=int.Parse(a[1]),L=O<3?0:G+1,F=O<3?-G:1;G=O%2>0?-G:G;for(;
F<L;F++)Console.Write("{0,"+G+"}\n","".PadRight(F<0?-F:F,' …
7
votes
Shortest Game of Life
C# - 675 chars
I've always wanted to write a version of this program. Never knew it would only take a lazy half hour for a quick and dirty version. (Golfing it takes much longer, of course.)
using S …