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
Totally blank app. aka 'rails ./ -d mysql' | |
[root@zibal testapp]# ./script/server | |
/opt/rubyee/lib/ruby/1.8/date/format.rb:813: [BUG] object allocation during garbage collection phase | |
ruby 1.8.7 (2009-12-24 patchlevel 248) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2010.01 | |
Aborted | |
[root@zibal testapp]# thin | |
/opt/rubyee/lib/ruby/1.8/date/format.rb:902: [BUG] object allocation during garbage collection phase | |
ruby 1.8.7 (2009-12-24 patchlevel 248) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2010.01 |
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
# A program to solve sodoku. | |
# First a few definitions, starting with array division | |
class Array | |
define_method "/" do |len| | |
a = [] | |
each_with_index do |x,i| | |
a << [] if i % len == 0 | |
a.last << x |
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
#include <cstdio> | |
#define EPS (double)10e-2 | |
#include <cmath> | |
using namespace std; | |
struct xy { | |
int x, y; | |
}; |
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
#include <cstdio> | |
#define EPS (double)10e-2 | |
#include <cmath> | |
using namespace std; | |
struct xy { | |
int x, y; | |
}; |
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
def hidden_singles | |
changed = false | |
@groups.each do |group| | |
numbers = [] | |
group.each do |cell| | |
numbers = numbers + @possible[cell] unless @possible[cell].size == 1 | |
end | |
(1..9).to_a.each do |number| | |
if numbers.count(number) == 1 | |
# There is only one spot where number can go in this group. find it! |
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
class Cell | |
def initialize | |
@possible = (1..9).to_a | |
end | |
def cant_be(value) | |
@possible = @possible - [value] | |
end | |
def must_be(value) |
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
def parents | |
@parents | |
end | |
def each_parent | |
@parents.each do |parent| | |
yeild(parents) | |
end | |
end | |
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
class Array | |
define_method "/" do |len| | |
a = [] | |
each_with_index do |x,i| | |
a << [] if i % len == 0 | |
a.last << x | |
end | |
a | |
end | |
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
# sudoku.rb | |
# A program to solve sodoku. | |
require './includes/utill.rb' | |
require './includes/cell.rb' | |
require './includes/group.rb' | |
require './includes/puzzle.rb' | |
class Sudoku |
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
# -*- coding: utf-8 -*- | |
import sys | |
lookback = "a" * 2703 | |
front = sys.stdin.read() | |
result = "" | |
lookup = {0: " ", 1: "a", 2: "b", 3: "c", 4: "d", 5: "e", 6: "f", 7: "g", 8: "h", | |
9: "i", 10: "j", 11: "k", 12: "l", 13: "m", 14: "n", 15: "o", 16: "p", | |
17: "q", 18: "r", 19: "s", 20: "t", 21: "u", 22: "v", 23: "w", 24: "x", |
OlderNewer