Skip to content

Instantly share code, notes, and snippets.

View hiratara's full-sized avatar
🇯🇵
born in Japan

Masahiro Honma hiratara

🇯🇵
born in Japan
View GitHub Profile
package PerlOnRails;
use strict;
use warnings;
use Exporter qw(import);
use Storable qw(dclone);
use List::MoreUtils qw(any uniq);
our @EXPORT_OK = qw(solve);
my %map = (
package Solver;
use strict;
use warnings;
no warnings 'experimental';
use feature qw(signatures postderef);
use Exporter qw(import);
use List::MoreUtils qw(all);
our @EXPORT_OK = qw(solve);
my $board = <<__BOARD__;
package Senbatu;
use strict;
use warnings;
use Exporter qw(import);
our @EXPORT_OK = qw(solve);
sub nat () {
my $n = 1;
sub { $n++ };
use strict;
use warnings;
use Exporter qw(import);
our @EXPORT = qw(solve);
my $cheet = <<__CHEET__;
0 1_12345 1_1
1 30_32451 3_30
2 1_12345|2_12345 1_1:2
3 3_12345|2_12345|1_12345 1_1:2:3
@hiratara
hiratara / a_ster.pl
Last active August 29, 2015 14:00
An A* algorithm for edit-graph-like pathes
use strict;
use warnings;
use List::Util qw(sum);
my @xs = (3, 3, 3);
my @ys = (2, 4);
my @diags = (
[5, 4, 3],
[6, 7, 5],
);
package VillainZamagawa;
use strict;
use warnings;
use Exporter qw(import);
our @EXPORT_OK = qw(solve);
sub end ($) {
my ($h, $m) = $_[0] =~ /^(\d\d)(\d\d)$/;
return sprintf '%02d%02d', $h + 1, $m;
}
package Hd;
use strict;
use warnings;
use Exporter qw(import);
use List::MoreUtils qw(any);
our @EXPORT_OK = ('solve');
my $D = 192;
@hiratara
hiratara / bukkowashi.pl
Created March 7, 2014 05:19
Just a reproduce code of my issue
use strict;
use warnings;
use File::Stamped;
my $f = "/tmp/bukkowase.txt";
{ open my $fh, '>', $f }
my @pids;
for (1 .. 50) {
if (my $pid = fork) {
package Regi;
use strict;
use warnings;
use Exporter qw(import);
our @EXPORT = qw(solve);
sub search_regi (@) { (sort { $a->length <=> $b->length } @_)[0] }
sub solve ($) {
use strict;
use warnings;
use Exporter qw(import);
our @EXPORTER = qw(solve);
sub lines ($) { 2 ** ($_[0] - 1) }
sub new_halls ($$) {
my ($b1, $b2) = @_;
lines $b1 * lines $b2;
}