Skip to content

Instantly share code, notes, and snippets.

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
# 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
#include <cstdio>
#define EPS (double)10e-2
#include <cmath>
using namespace std;
struct xy {
int x, y;
};
#include <cstdio>
#define EPS (double)10e-2
#include <cmath>
using namespace std;
struct xy {
int x, y;
};
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!
class Cell
def initialize
@possible = (1..9).to_a
end
def cant_be(value)
@possible = @possible - [value]
end
def must_be(value)
def parents
@parents
end
def each_parent
@parents.each do |parent|
yeild(parents)
end
end
class Array
define_method "/" do |len|
a = []
each_with_index do |x,i|
a << [] if i % len == 0
a.last << x
end
a
end
# 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
# -*- 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",