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
object randomCapitals { | |
def randomUpper(sentence: String) = { | |
sentence.map(c => | |
if (math.random > .5) | |
c.toUpper | |
else | |
c.toLower) | |
} | |
def main(args: Array[String]) { |
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
public class Paul { | |
public static void printArray(int[] array) { | |
System.out.print("{"); | |
for (int i = 0; i < array.length; i++) { | |
System.out.print(array[i]); | |
if (i < array.length - 1) { | |
System.out.print(", "); | |
} |
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
public class randomCapitals { | |
public static String randomUpper(String sentence) { | |
StringBuilder output = new StringBuilder(); | |
for (int i = 0; i < sentence.length(); i++) { | |
char c = sentence.charAt(i); | |
if (Math.random() > .5) { | |
c = Character.toUpperCase(c); | |
} else { |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
func main() { | |
rand.Seed(time.Now().UnixNano()) |
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
public class Chess960 { | |
public static void main(String[] args) { | |
char[] board = new char[8]; | |
for (int i = 0; i < 2; i++) { | |
int r = (int) (Math.random() * 4) * 2; | |
if (i == 1) { | |
r++; | |
} |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
my %hash; | |
my $output = 0; | |
open FILE, "TWL06.txt" or die $!; | |
while (<FILE>) { |
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
#!/usr/bin/env python | |
import collections | |
d = collections.defaultdict(list) | |
output = 0 | |
f = open("TWL06.txt") | |
for line in f.readlines(): | |
line = line.strip().lower() |
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use feature qw(switch say); | |
use Getopt::Std; | |
use LWP::Simple; | |
sub help { | |
say "Usage: $0 [-cf] <zip code>"; | |
exit; |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Getopt::Std; | |
use feature 'say'; | |
sub yesno { | |
my ($prompt) = @_; | |
print "$prompt [Y/n] "; |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use feature "say"; | |
use WWW::Mechanize; | |
my $dir = "yb"; | |
my $url = "http://www.cs.utexas.edu/users/peterson/yb/"; | |
my $mech = WWW::Mechanize->new(); |