Skip to content

Instantly share code, notes, and snippets.

View mizuhara's full-sized avatar

Masaya Mizuhara mizuhara

View GitHub Profile
require 'minitest/autorun'
class Room
attr_reader :room_number
def initialize(room_number, x, y, side_length)
@room_number = room_number
@x, @y, @side_length = x, y, side_length
end
using System;
using System.Linq;
namespace yhpg
{
internal enum Direction
{
Up = 0, Down, Left, Right, None
}
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
#include <algorithm>
using matrix_t = std::vector<std::vector<int>>;
const std::string commands { "abcdefihglkj" };
#include <cctype>
#include <string>
#include <vector>
#include <sstream>
#include <iterator>
#include <iostream>
#include <algorithm>
const char unoccupied_char = '-';
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include "boost/range/adaptors.hpp"
#include "boost/algorithm/string.hpp"
const int invalid_pos = -1;
const std::string empty_string = "0";
const std::string block_string = "1";
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
#include <iterator>
#include <algorithm>
const std::vector<int> lines = {
128, 64, 32, 16, 8, 4, 2, 1,
};
#include <string>
#include <vector>
#include <iostream>
class HexagonalTetromino
{
public:
HexagonalTetromino(
const std::string & name,
const std::string & src,
#include <regex>
#include <string>
#include <vector>
#include <numeric>
#include <iostream>
#include "boost/algorithm/string.hpp"
class Triomino
{
public:
#include <vector>
#include <string>
#include <memory>
#include <iostream>
#include <algorithm>
#include <unordered_map>
struct is_tetromino
{
bool operator()(char chr)
const flatten = (ary) => {
return [].concat(...ary);
};
const parse = (src) => {
return flatten(flatten(src.split('/').map((rect) => {
return rect.split('-');
})).map((pt) => {
return pt.split(',');
})).map((s) => {