File: gen_card_compare_table.rb

package info (click to toggle)
freecell-solver 3.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,332 kB
  • sloc: ansic: 29,493; perl: 8,911; xml: 5,162; python: 1,124; sh: 777; ruby: 358; cpp: 304; makefile: 150
file content (12 lines) | stat: -rw-r--r-- 408 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
values = ([-1] * 256)
(1 .. 13).each do |rank|
    (0 .. 3).each do |suit|
        values[(suit << 4) | rank] = ((rank << 2) | suit)
    end
end

File.open("card_compare_lookups.c", "w") do |fh|
    fh.puts("/* WARNING! This file is generated from gen_card_compare_table.rb */");
    fh.puts("signed char fc_solve_card_compare_lookup[256] = { " +
            values.map{ |i| i.to_s() }.join(',') + "};")
end