Skip to content

Instantly share code, notes, and snippets.

@ryanfb
Created October 10, 2008 02:14
Show Gist options
  • Save ryanfb/15968 to your computer and use it in GitHub Desktop.
Save ryanfb/15968 to your computer and use it in GitHub Desktop.
proc eotw args {set week [clock format [clock seconds] -format "%U"]; if {[lsearch [array names ::eotws] $week] < 0} {set a 0;set b 0;set c 0;set d 0; while {!$a} {set a [expr int(12*rand())-6]};while {!$b} {set b [expr int(12*rand())-6]};while {!$c} {set c [expr int(12*rand())-6]};while {!$d} {set d [expr int(12*rand())-6]};set ::eotws($week) [list [expr $a*$c] [expr $a*$d+$b*$c] [expr $b*$d]];};set a "[lindex $::eotws($week) 0]x^2";set b [lindex $::eotws($week) 1];if {$b > 0} {set b " + [expr $b]x"} elseif {$b eq 0} {set b ""} else {set o " - [expr abs($b)]x"};set c [lindex $::eotws($week) 2];if {$c > 0} {set c " + $c" } elseif {$c eq 0} {set c ""} else {set c " - [expr abs($c)]"};return "Congratulations y = $a$b$c\nYou are the\nequation of the week";}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment