À l'aide de l'ASCII, imprimez une section d'un pavage annulaire hexagonal.
Voici une petite section:
/\__/\
/_/ \_\
/\__/\ \__/ /\__/\
/_/ \_\/__\/_/ \_\
\ \__/ /\__/\ \__/ /
\/__\/_/ \_\/__\/
/\__/\ \__/ /\__/\
/_/ \_\/__\/_/ \_\
\ \__/ /\__/\ \__/ /
\/__\/_/ \_\/__\/
\ \__/ /
\/__\/
Voici une plus grande section:
\ \__/ /\__/\ \__/ /\__/\ \__/ /\__/\ \__/ /\__/\
\/__\/_/ \_\/__\/_/ \_\/__\/_/ \_\/__\/_/ \_\
/\__/\ \__/ /\__/\ \__/ /\__/\ \__/ /\__/\ \__/ /
/_/ \_\/__\/_/ \_\/__\/_/ \_\/__\/_/ \_\/__\/
\ \__/ /\__/\ \__/ /\__/\ \__/ /\__/\ \__/ /\__/\
\/__\/_/ \_\/__\/_/ \_\/__\/_/ \_\/__\/_/ \_\
/\__/\ \__/ /\__/\ \__/ /\__/\ \__/ /\__/\ \__/ /
/_/ \_\/__\/_/ \_\/__\/_/ \_\/__\/_/ \_\/__\/
\ \__/ /\__/\ \__/ /\__/\ \__/ /\__/\ \__/ /\__/\
\/__\/_/ \_\/__\/_/ \_\/__\/_/ \_\/__\/_/ \_\
/\__/\ \__/ /\__/\ \__/ /\__/\ \__/ /\__/\ \__/ /
/_/ \_\/__\/_/ \_\/__\/_/ \_\/__\/_/ \_\/__\/
Défi
Étant donné 2 nombres entiers h
et w
, où h
est la hauteur et w
la largeur, sortez une hxw
section d'un pavage annulaire hexagonal.
Exemples
Entrée 1
4x4
Sortie 1
/\__/\ \__/ /\__/\ \__/ /
/_/ \_\/__\/_/ \_\/__\/
\ \__/ /\__/\ \__/ /\__/\
\/__\/_/ \_\/__\/_/ \_\
/\__/\ \__/ /\__/\ \__/ /
/_/ \_\/__\/_/ \_\/__\/
\ \__/ /\__/\ \__/ /\__/\
\/__\/_/ \_\/__\/_/ \_\
/\__/\ \__/ /\__/\ \__/ /
/_/ \_\/__\/_/ \_\/__\/
\ \__/ /\__/\ \__/ /\__/\
\/__\/_/ \_\/__\/_/ \_\
/\__/\ \__/ /\__/\ \__/ /
/_/ \_\/__\/_/ \_\/__\/
\ \__/ /\__/\ \__/ /\__/\
\/__\/_/ \_\/__\/_/ \_\
Entrée 2
3x3
Sortie 2
/\__/\ \__/ /\__/\
/_/ \_\/__\/_/ \_\
\ \__/ /\__/\ \__/ /
\/__\/_/ \_\/__\/
/\__/\ \__/ /\__/\
/_/ \_\/__\/_/ \_\
\ \__/ /\__/\ \__/ /
\/__\/_/ \_\/__\/
/\__/\ \__/ /\__/\
/_/ \_\/__\/_/ \_\
\ \__/ /\__/\ \__/ /
\/__\/_/ \_\/__\/
Entrée 3
1x3
Sortie 3
/\__/\ \__/ /\__/\
/_/ \_\/__\/_/ \_\
\ \__/ /\__/\ \__/ /
\/__\/_/ \_\/__\/
Entrée 4
3x6
Sortie 4
/\__/\ \__/ /\__/\ \__/ /\__/\ \__/ /
/_/ \_\/__\/_/ \_\/__\/_/ \_\/__\/
\ \__/ /\__/\ \__/ /\__/\ \__/ /\__/\
\/__\/_/ \_\/__\/_/ \_\/__\/_/ \_\
/\__/\ \__/ /\__/\ \__/ /\__/\ \__/ /
/_/ \_\/__\/_/ \_\/__\/_/ \_\/__\/
\ \__/ /\__/\ \__/ /\__/\ \__/ /\__/\
\/__\/_/ \_\/__\/_/ \_\/__\/_/ \_\
/\__/\ \__/ /\__/\ \__/ /\__/\ \__/ /
/_/ \_\/__\/_/ \_\/__\/_/ \_\/__\/
\ \__/ /\__/\ \__/ /\__/\ \__/ /\__/\
\/__\/_/ \_\/__\/_/ \_\/__\/_/ \_\
Clarifications
- Ma question est similaire à celle-ci: Me Want Honeycomb .
- L'entrée sera sur une seule ligne dans le formulaire
hxw
. - Sortie vers stdout (ou quelque chose de similaire).
- C'est le code-golf, donc la réponse la plus courte en octets gagne.