summaryrefslogtreecommitdiff
path: root/script/qr-color.pl
blob: 5841e0f1f9c3921db5bc656ee240bc81045bc105 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/usr/bin/perl 
use utf8;
use strict;
use warnings;
use Text::QRCode;
use TextPrinter::ColourGrid;
use TextPrinter::StarGrid;
use GridFiller;
use GridFiller::Scaler;
use feature 'say';
use open ':std',':locale';
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init($INFO);
 
binmode DATA,':utf8';
 
my $data = do { local $/="\n__WORDS__\n";my $x=<DATA>;chomp $x;$x };
my @words = <DATA>;chomp @words;
 
my $qr=Text::QRCode->new(
    level=>'H',
    mode=>'8-bit',
);
 
my $arr=$qr->plot($data);
 
my $filler=GridFiller->new({
    words=>\@words,
    grid=> GridFiller::Scaler->scale($arr,2),
});
 
my $result = $filler->fill({
    mode => 'longest',
    chooser => 'Smarter',
});
 
TextPrinter::ColourGrid->new->draw_whole($result->grid,1);
 
say '';
say 'Leftovers:';
say for @{$result->leftover_words};
 
__DATA__
MECARD:N:Ceccarelli,Gianni;TEL:+447564023056;EMAIL:dakkar@thenautilus.net;URL:http://www.thenautilus.net/contacts/;NICKNAME:dakkar;;
__WORDS__
Lois McMaster Bujold
Kage Baker
David Weber
Robert Heinlein
Douglas Adams
Neal Stephenson
Lewis Carrol
Terry Pratchett
Jorge Luis Borges
Frank Herbert
Alessandro Bergonzoni
Stefano Benni
Jules Verne
Neil Gaiman
H.G. Wells
Isaac Asimov
Arthur C. Clarke
Philip K. Dick
JRR Tolkien
Ed Wood
Tim Burton
Monty Python
Terry Gilliam
Orson Welles
Peter Greenaway
David Cronenberg
Stanley Kubrick
Joss Whedon
Quentin Tarantino
Mel Brooks
MIYAZAKI Hayao
OSHII Mamoru
ANNO Hideaki
Alan Moore
KITOH Mohiro
TEZUKA Osamu
YUKI Masami
URASAWA Naoki
YUKINOBU Hoshino
yoshitoshi ABe
SHIROW Masamune
Amanda Palmer
Marian Call
Jonathan Coulton
The Flaming Lips
The Pillows
Nightwish
Stefano Nosei
Jethro Tull
KANNO Yoko
Franco Battiato
Enya
Helloween
Mike Oldfield
Alan Parsons Project
Emerson, Lake & Palmer
Fabrizio De André
Kenji Kawai
David Bowie
Girl Genius
Gunnerkrigg Court
Cyrano de Bergerac
Watership Down
RHPS
Thunderbirds
Doctor Who
The Twilight Zone
Blade Runner
Forbidden Planet
Cowboy Bebop
FLCL
Gundam
Macross
Fushigi no umi no Nadia
SUZUMIYA Haruhi
Cutey Honey
Dennou Coil
Haibane Renmei
Star Trek
D&D
Go
Shogi
Perl