adding encoding systems, puzzles and mazes and maps notebooks
After Width: | Height: | Size: 1001 KiB |
@ -0,0 +1,467 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Labyrinths and mazes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"```\n",
|
||||
"🐭\n",
|
||||
"┃┣━━━┳━━━━┳━━┓\n",
|
||||
"┃┗┓┏┛┃╻╺━━┛╺┓┃\n",
|
||||
"┣┓┃┗┓┗┻━━━┳╸┃┃\n",
|
||||
"┃┃┣╸┣━━┳━┓┗━┛┃\n",
|
||||
"┃┃┃┏┛┏╸┃╻┣━┳╸┃\n",
|
||||
"┃┗━┫╻┣━━┫┗╸┃┏┫\n",
|
||||
"┃┏━┫┃┃╺┓┗━┓┃┃┃\n",
|
||||
"┃┃┃┃┃┗┓┗━┓┗┻╸┃\n",
|
||||
"┗━┫┏┻━━━━┻━━━┛\n",
|
||||
" 🧀\n",
|
||||
"```\n",
|
||||
"http://xahlee.info/comp/unicode_drawing_shapes.html by [Xah Lee](http://xahlee.org/index.html)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Situationist Times #04: International Labyrinth Edition\n",
|
||||
"\n",
|
||||
"[![](https://vandal.ist/thesituationisttimes/covers/st04.cover.m.jpg)](https://vandal.ist/thesituationisttimes/04/)\n",
|
||||
"\n",
|
||||
"Jacqueline de Jong (one of the makers of the Situationist Times) talking about [printed mazes with overlay](https://vandal.ist/thesituationisttimes/04/index.html#8/-1.869/118.973).\n",
|
||||
"\n",
|
||||
"The PDFs of the Situationist Times are [available on Monoskop](https://monoskop.org/Situationist_Times)! "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 10 PRINT\n",
|
||||
"\n",
|
||||
"Nick Montfort and others compilation of maze generation and other simple scripts from early home computing.\n",
|
||||
"\n",
|
||||
"https://hub.xpub.nl/bootleglibrary/book/583\n",
|
||||
"\n",
|
||||
"Some links to nice parts:\n",
|
||||
"\n",
|
||||
"* Including [what is a maze](https://hub.xpub.nl/bootleglibrary/read/583/pdf#page=47), and the ever useful (controversial?) distinction between maze and labyrinth...\n",
|
||||
"\n",
|
||||
"> The terms “maze” and “labyrinth” are generally synonyms in colloquial English. Still, many scholars and historians have argued over the distinction between these two terms. In the most popular proposed distinction, “labyrinth” refers only to single-path (unicursal) structures, while “maze” refers only to branching-path (multicursal) structures.In this book, the terms “maze” and “labyrinth” are not used to distinguish two different categories of structure or image. Instead, the two terms indicate a single conceptual category, with this book primarily using the term “maze” for both\n",
|
||||
"\n",
|
||||
"* the [map from Atari adventure](https://hub.xpub.nl/bootleglibrary/read/583/pdf#page=62), \n",
|
||||
"* the (missing) [Vera Molnar work](https://hub.xpub.nl/bootleglibrary/read/583/pdf#page=78) but which you can see [online](https://www.centrepompidou.fr/fr/ressources/oeuvre/cez6op), \n",
|
||||
"* the [commodore keyboard](https://hub.xpub.nl/bootleglibrary/read/583/pdf#page=227) and the [PETSCII table in the manual](https://hub.xpub.nl/bootleglibrary/read/583/pdf#page=238)\n",
|
||||
"\n",
|
||||
"AND an interesting link to the conversation about popular culture and the middle-class:\n",
|
||||
"\n",
|
||||
"![](Screenshot-c64-ad.png)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Fun With Python #1: Maze Generator\n",
|
||||
"\n",
|
||||
"This notebook is based on the Medium article \"Fun with Python part 1: Maze Generator\" written by [Orestis Zekai](https://orestiszekai.com/) in 2020. \n",
|
||||
"\n",
|
||||
"It is a nice tutorial which talks you through a Python implementation of a maze generator. \n",
|
||||
"\n",
|
||||
"You can find the tutorial here: https://medium.com/swlh/fun-with-python-1-maze-generator-931639b4fb7e\n",
|
||||
"\n",
|
||||
"The maze generator is based on a **randomized version of Prim's algorithm**, which is one of the [maze algorithms](https://en.wikipedia.org/wiki/Maze_generation_algorithm) that is used to generate a maze:\n",
|
||||
"\n",
|
||||
"* Start with a grid full of walls.\n",
|
||||
"* Pick a cell, mark it as part of the maze. Add the walls of the cell to the wall list.\n",
|
||||
"* While there are walls in the list:\n",
|
||||
" * Pick a random wall from the list. If only one of the cells that the wall divides is visited, then:\n",
|
||||
" * Make the wall a passage and mark the unvisited cell as part of the maze.\n",
|
||||
" * Add the neighboring walls of the cell to the wall list.\n",
|
||||
" * Remove the wall from the list."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Generating mazes on paper\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"\n",
|
||||
" <iframe\n",
|
||||
" width=\"600\"\n",
|
||||
" height=\"400\"\n",
|
||||
" src=\"maze-algorithm-on-paper.pdf\"\n",
|
||||
" frameborder=\"0\"\n",
|
||||
" allowfullscreen\n",
|
||||
" ></iframe>\n",
|
||||
" "
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.lib.display.IFrame at 0x7f5b1838ec18>"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from IPython.display import IFrame\n",
|
||||
"IFrame(\"maze-algorithm-on-paper.pdf\", width=600, height=400)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Maze Generator\n",
|
||||
"\n",
|
||||
"The code below is a slightly adapted version of `maze.py` written by Orestis Zekai: https://github.com/OrWestSide/python-scripts/blob/master/maze.py\n",
|
||||
"\n",
|
||||
"You can use the code to generate custom mazes. \n",
|
||||
"\n",
|
||||
"Change the following variables in the code, to make your maze bigger or smaller and to change how your maze looks like!\n",
|
||||
"\n",
|
||||
"```\n",
|
||||
"# --------------------------\n",
|
||||
"wall_tile = \"▓\"\n",
|
||||
"cell_tile = \"░\"\n",
|
||||
"height = 11\n",
|
||||
"width = 27\n",
|
||||
"# --------------------------\n",
|
||||
"\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"**NOTE**: The code below is a slightly different version of the code from the tutorial. The variable names are changed in the double for-loops, to make them connect to the other canvas examples in the other notebooks. For example, a for loop to move block by block through the maze is written below in the following way, using `y` and `x` to refer to the coordinates of a block:\n",
|
||||
"\n",
|
||||
"```\n",
|
||||
"for y in range(height):\n",
|
||||
" for x in range(width):\n",
|
||||
" if (maze[y][x] == \"u\"):\n",
|
||||
" print(unvisited, end=\"\")\n",
|
||||
"```"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"▓░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓\n",
|
||||
"▓░▓▓░▓▓░▓░▓░░░░░░░░▓░░░░░░▓\n",
|
||||
"▓░░░░░░░░░░░▓▓░▓░▓░░░▓░▓▓▓▓\n",
|
||||
"▓░▓▓▓▓▓▓▓▓░▓▓▓░▓░▓▓▓░▓░░░░▓\n",
|
||||
"▓░░░░░░░░▓▓▓░▓▓▓░░▓▓▓▓▓▓▓▓▓\n",
|
||||
"▓░▓░▓▓▓▓░░░░░░░▓▓░░░▓░▓▓▓▓▓\n",
|
||||
"▓░▓░░▓▓▓▓▓▓▓░▓░░▓░▓░░░░░░░▓\n",
|
||||
"▓░▓▓░░░░░░▓▓░▓▓░▓░▓░▓▓░▓░▓▓\n",
|
||||
"▓▓▓▓▓░▓▓▓▓▓▓░░▓░▓▓▓░░▓░▓▓▓▓\n",
|
||||
"▓░░░░░░░░░░▓░▓▓░▓▓░░▓▓░░░░▓\n",
|
||||
"▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░▓\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Maze generator -- Randomized Prim Algorithm\n",
|
||||
"\n",
|
||||
"## Imports\n",
|
||||
"import random\n",
|
||||
"\n",
|
||||
"## Functions\n",
|
||||
"def printMaze(maze):\n",
|
||||
" for y in range(height):\n",
|
||||
" for x in range(width):\n",
|
||||
" if (maze[y][x] == \"u\"):\n",
|
||||
" print(unvisited, end=\"\")\n",
|
||||
" elif (maze[y][x] == \"c\"):\n",
|
||||
" print(cell_tile, end=\"\")\n",
|
||||
" else:\n",
|
||||
" print(wall_tile, end=\"\")\n",
|
||||
" \n",
|
||||
" print(\"\")\n",
|
||||
"\n",
|
||||
"# Find number of surrounding cells\n",
|
||||
"def surroundingCells(rand_wall):\n",
|
||||
" s_cells = 0\n",
|
||||
" if (maze[rand_wall[0]-1][rand_wall[1]] == \"c\"):\n",
|
||||
" s_cells += 1\n",
|
||||
" if (maze[rand_wall[0]+1][rand_wall[1]] == \"c\"):\n",
|
||||
" s_cells += 1\n",
|
||||
" if (maze[rand_wall[0]][rand_wall[1]-1] == \"c\"):\n",
|
||||
" s_cells +=1\n",
|
||||
" if (maze[rand_wall[0]][rand_wall[1]+1] == \"c\"):\n",
|
||||
" s_cells += 1\n",
|
||||
"\n",
|
||||
" return s_cells\n",
|
||||
"\n",
|
||||
"## Main code\n",
|
||||
"\n",
|
||||
"# Init variables\n",
|
||||
"# --------------------------\n",
|
||||
"wall_tile = \"▓\"\n",
|
||||
"cell_tile = \"░\"\n",
|
||||
"height = 11\n",
|
||||
"width = 27\n",
|
||||
"# --------------------------\n",
|
||||
"wall = \"w\"\n",
|
||||
"cell = \"c\"\n",
|
||||
"unvisited = \"u\"\n",
|
||||
"maze = []\n",
|
||||
"\n",
|
||||
"# Denote all cells as unvisited\n",
|
||||
"for y in range(height):\n",
|
||||
" line = []\n",
|
||||
" for x in range(width):\n",
|
||||
" line.append(unvisited)\n",
|
||||
" maze.append(line)\n",
|
||||
"\n",
|
||||
"# Randomize starting point and set it a cell\n",
|
||||
"starting_height = int(random.random()*height)\n",
|
||||
"starting_width = int(random.random()*width)\n",
|
||||
"if (starting_height == 0):\n",
|
||||
" starting_height += 1\n",
|
||||
"if (starting_height == height-1):\n",
|
||||
" starting_height -= 1\n",
|
||||
"if (starting_width == 0):\n",
|
||||
" starting_width += 1\n",
|
||||
"if (starting_width == width-1):\n",
|
||||
" starting_width -= 1\n",
|
||||
"\n",
|
||||
"# Mark it as cell and add surrounding walls to the list\n",
|
||||
"maze[starting_height][starting_width] = cell\n",
|
||||
"walls = []\n",
|
||||
"walls.append([starting_height - 1, starting_width])\n",
|
||||
"walls.append([starting_height, starting_width - 1])\n",
|
||||
"walls.append([starting_height, starting_width + 1])\n",
|
||||
"walls.append([starting_height + 1, starting_width])\n",
|
||||
"\n",
|
||||
"# Denote walls in maze\n",
|
||||
"maze[starting_height-1][starting_width] = \"w\"\n",
|
||||
"maze[starting_height][starting_width - 1] = \"w\"\n",
|
||||
"maze[starting_height][starting_width + 1] = \"w\"\n",
|
||||
"maze[starting_height + 1][starting_width] = \"w\"\n",
|
||||
"\n",
|
||||
"while (walls):\n",
|
||||
" # Pick a random wall\n",
|
||||
" rand_wall = walls[int(random.random()*len(walls))-1]\n",
|
||||
"\n",
|
||||
" # Check if it is a left wall\n",
|
||||
" if (rand_wall[1] != 0):\n",
|
||||
" if (maze[rand_wall[0]][rand_wall[1]-1] == \"u\" and maze[rand_wall[0]][rand_wall[1]+1] == \"c\"):\n",
|
||||
" # Find the number of surrounding cells\n",
|
||||
" s_cells = surroundingCells(rand_wall)\n",
|
||||
"\n",
|
||||
" if (s_cells < 2):\n",
|
||||
" # Denote the new path\n",
|
||||
" maze[rand_wall[0]][rand_wall[1]] = \"c\"\n",
|
||||
"\n",
|
||||
" # Mark the new walls\n",
|
||||
" # Upper cell\n",
|
||||
" if (rand_wall[0] != 0):\n",
|
||||
" if (maze[rand_wall[0]-1][rand_wall[1]] != \"c\"):\n",
|
||||
" maze[rand_wall[0]-1][rand_wall[1]] = \"w\"\n",
|
||||
" if ([rand_wall[0]-1, rand_wall[1]] not in walls):\n",
|
||||
" walls.append([rand_wall[0]-1, rand_wall[1]])\n",
|
||||
"\n",
|
||||
" # Bottom cell\n",
|
||||
" if (rand_wall[0] != height-1):\n",
|
||||
" if (maze[rand_wall[0]+1][rand_wall[1]] != \"c\"):\n",
|
||||
" maze[rand_wall[0]+1][rand_wall[1]] = \"w\"\n",
|
||||
" if ([rand_wall[0]+1, rand_wall[1]] not in walls):\n",
|
||||
" walls.append([rand_wall[0]+1, rand_wall[1]])\n",
|
||||
"\n",
|
||||
" # Leftmost cell\n",
|
||||
" if (rand_wall[1] != 0): \n",
|
||||
" if (maze[rand_wall[0]][rand_wall[1]-1] != \"c\"):\n",
|
||||
" maze[rand_wall[0]][rand_wall[1]-1] = \"w\"\n",
|
||||
" if ([rand_wall[0], rand_wall[1]-1] not in walls):\n",
|
||||
" walls.append([rand_wall[0], rand_wall[1]-1])\n",
|
||||
"\n",
|
||||
" # Delete wall\n",
|
||||
" for wall in walls:\n",
|
||||
" if (wall[0] == rand_wall[0] and wall[1] == rand_wall[1]):\n",
|
||||
" walls.remove(wall)\n",
|
||||
"\n",
|
||||
" continue\n",
|
||||
"\n",
|
||||
" # Check if it is an upper wall\n",
|
||||
" if (rand_wall[0] != 0):\n",
|
||||
" if (maze[rand_wall[0]-1][rand_wall[1]] == \"u\" and maze[rand_wall[0]+1][rand_wall[1]] == \"c\"):\n",
|
||||
"\n",
|
||||
" s_cells = surroundingCells(rand_wall)\n",
|
||||
" if (s_cells < 2):\n",
|
||||
" # Denote the new path\n",
|
||||
" maze[rand_wall[0]][rand_wall[1]] = \"c\"\n",
|
||||
"\n",
|
||||
" # Mark the new walls\n",
|
||||
" # Upper cell\n",
|
||||
" if (rand_wall[0] != 0):\n",
|
||||
" if (maze[rand_wall[0]-1][rand_wall[1]] != \"c\"):\n",
|
||||
" maze[rand_wall[0]-1][rand_wall[1]] = \"w\"\n",
|
||||
" if ([rand_wall[0]-1, rand_wall[1]] not in walls):\n",
|
||||
" walls.append([rand_wall[0]-1, rand_wall[1]])\n",
|
||||
"\n",
|
||||
" # Leftmost cell\n",
|
||||
" if (rand_wall[1] != 0):\n",
|
||||
" if (maze[rand_wall[0]][rand_wall[1]-1] != \"c\"):\n",
|
||||
" maze[rand_wall[0]][rand_wall[1]-1] = \"w\"\n",
|
||||
" if ([rand_wall[0], rand_wall[1]-1] not in walls):\n",
|
||||
" walls.append([rand_wall[0], rand_wall[1]-1])\n",
|
||||
"\n",
|
||||
" # Rightmost cell\n",
|
||||
" if (rand_wall[1] != width-1):\n",
|
||||
" if (maze[rand_wall[0]][rand_wall[1]+1] != \"c\"):\n",
|
||||
" maze[rand_wall[0]][rand_wall[1]+1] = \"w\"\n",
|
||||
" if ([rand_wall[0], rand_wall[1]+1] not in walls):\n",
|
||||
" walls.append([rand_wall[0], rand_wall[1]+1])\n",
|
||||
"\n",
|
||||
" # Delete wall\n",
|
||||
" for wall in walls:\n",
|
||||
" if (wall[0] == rand_wall[0] and wall[1] == rand_wall[1]):\n",
|
||||
" walls.remove(wall)\n",
|
||||
"\n",
|
||||
" continue\n",
|
||||
"\n",
|
||||
" # Check the bottom wall\n",
|
||||
" if (rand_wall[0] != height-1):\n",
|
||||
" if (maze[rand_wall[0]+1][rand_wall[1]] == \"u\" and maze[rand_wall[0]-1][rand_wall[1]] == \"c\"):\n",
|
||||
"\n",
|
||||
" s_cells = surroundingCells(rand_wall)\n",
|
||||
" if (s_cells < 2):\n",
|
||||
" # Denote the new path\n",
|
||||
" maze[rand_wall[0]][rand_wall[1]] = \"c\"\n",
|
||||
"\n",
|
||||
" # Mark the new walls\n",
|
||||
" if (rand_wall[0] != height-1):\n",
|
||||
" if (maze[rand_wall[0]+1][rand_wall[1]] != \"c\"):\n",
|
||||
" maze[rand_wall[0]+1][rand_wall[1]] = \"w\"\n",
|
||||
" if ([rand_wall[0]+1, rand_wall[1]] not in walls):\n",
|
||||
" walls.append([rand_wall[0]+1, rand_wall[1]])\n",
|
||||
" if (rand_wall[1] != 0):\n",
|
||||
" if (maze[rand_wall[0]][rand_wall[1]-1] != \"c\"):\n",
|
||||
" maze[rand_wall[0]][rand_wall[1]-1] = \"w\"\n",
|
||||
" if ([rand_wall[0], rand_wall[1]-1] not in walls):\n",
|
||||
" walls.append([rand_wall[0], rand_wall[1]-1])\n",
|
||||
" if (rand_wall[1] != width-1):\n",
|
||||
" if (maze[rand_wall[0]][rand_wall[1]+1] != \"c\"):\n",
|
||||
" maze[rand_wall[0]][rand_wall[1]+1] = \"w\"\n",
|
||||
" if ([rand_wall[0], rand_wall[1]+1] not in walls):\n",
|
||||
" walls.append([rand_wall[0], rand_wall[1]+1])\n",
|
||||
"\n",
|
||||
" # Delete wall\n",
|
||||
" for wall in walls:\n",
|
||||
" if (wall[0] == rand_wall[0] and wall[1] == rand_wall[1]):\n",
|
||||
" walls.remove(wall)\n",
|
||||
"\n",
|
||||
" continue\n",
|
||||
"\n",
|
||||
" # Check the right wall\n",
|
||||
" if (rand_wall[1] != width-1):\n",
|
||||
" if (maze[rand_wall[0]][rand_wall[1]+1] == \"u\" and maze[rand_wall[0]][rand_wall[1]-1] == \"c\"):\n",
|
||||
"\n",
|
||||
" s_cells = surroundingCells(rand_wall)\n",
|
||||
" if (s_cells < 2):\n",
|
||||
" # Denote the new path\n",
|
||||
" maze[rand_wall[0]][rand_wall[1]] = \"c\"\n",
|
||||
"\n",
|
||||
" # Mark the new walls\n",
|
||||
" if (rand_wall[1] != width-1):\n",
|
||||
" if (maze[rand_wall[0]][rand_wall[1]+1] != \"c\"):\n",
|
||||
" maze[rand_wall[0]][rand_wall[1]+1] = \"w\"\n",
|
||||
" if ([rand_wall[0], rand_wall[1]+1] not in walls):\n",
|
||||
" walls.append([rand_wall[0], rand_wall[1]+1])\n",
|
||||
" if (rand_wall[0] != height-1):\n",
|
||||
" if (maze[rand_wall[0]+1][rand_wall[1]] != \"c\"):\n",
|
||||
" maze[rand_wall[0]+1][rand_wall[1]] = \"w\"\n",
|
||||
" if ([rand_wall[0]+1, rand_wall[1]] not in walls):\n",
|
||||
" walls.append([rand_wall[0]+1, rand_wall[1]])\n",
|
||||
" if (rand_wall[0] != 0): \n",
|
||||
" if (maze[rand_wall[0]-1][rand_wall[1]] != \"c\"):\n",
|
||||
" maze[rand_wall[0]-1][rand_wall[1]] = \"w\"\n",
|
||||
" if ([rand_wall[0]-1, rand_wall[1]] not in walls):\n",
|
||||
" walls.append([rand_wall[0]-1, rand_wall[1]])\n",
|
||||
"\n",
|
||||
" # Delete wall\n",
|
||||
" for wall in walls:\n",
|
||||
" if (wall[0] == rand_wall[0] and wall[1] == rand_wall[1]):\n",
|
||||
" walls.remove(wall)\n",
|
||||
"\n",
|
||||
" continue\n",
|
||||
"\n",
|
||||
" # Delete the wall from the list anyway\n",
|
||||
" for wall in walls:\n",
|
||||
" if (wall[0] == rand_wall[0] and wall[1] == rand_wall[1]):\n",
|
||||
" walls.remove(wall)\n",
|
||||
" \n",
|
||||
"# Mark the remaining unvisited cells as walls\n",
|
||||
"for y in range(height):\n",
|
||||
" for x in range(width):\n",
|
||||
" if (maze[y][x] == \"u\"):\n",
|
||||
" maze[y][x] = \"w\"\n",
|
||||
"\n",
|
||||
"# Set entrance and exit\n",
|
||||
"for x in range(width):\n",
|
||||
" if (maze[1][x] == \"c\"):\n",
|
||||
" maze[0][x] = \"c\"\n",
|
||||
" break\n",
|
||||
"\n",
|
||||
"for x in range(width-1, 0, -1):\n",
|
||||
" if (maze[height-2][x] == \"c\"):\n",
|
||||
" maze[height-1][x] = \"c\"\n",
|
||||
" break\n",
|
||||
"\n",
|
||||
"# Print final maze\n",
|
||||
"printMaze(maze)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
@ -0,0 +1,484 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Generating maps"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## A*maze*ing maps with game assets\n",
|
||||
"\n",
|
||||
"Our journey begins here...\n",
|
||||
"\n",
|
||||
"https://www.kenney.nl/assets/cartography-pack"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"scrolled": true,
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!wget \"https://www.kenney.nl/content/3-assets/26-cartography-pack/cartographypack.zip\"\n",
|
||||
"!mkdir cartographypack\n",
|
||||
"!unzip cartographypack.zip -d cartographypack"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!ls cartographypack/PNG/Default/path*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from glob import glob\n",
|
||||
"import os\n",
|
||||
"from IPython.display import display, HTML\n",
|
||||
"\n",
|
||||
"html = \"\"\n",
|
||||
"\n",
|
||||
"for img_path in glob(\"cartographypack/PNG/Default/path*\"):\n",
|
||||
"\n",
|
||||
" html += f'<img src=\"{ img_path }\" style=\"float:left;\">'\n",
|
||||
"\n",
|
||||
"display(HTML(html))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from random import choice\n",
|
||||
"\n",
|
||||
"pieces = glob(\"cartographypack/PNG/Default/path*\")\n",
|
||||
"html = \"\"\n",
|
||||
"\n",
|
||||
"for i in range(100):\n",
|
||||
" piece = choice(pieces)\n",
|
||||
" html += f'<img src=\"{ piece }\" style=\"float:left;\">'\n",
|
||||
" \n",
|
||||
"display(HTML(html))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Stepping away from random.choice(): writing an algorithm to generate patterns"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"In order to generate patterns in a non-random way, we might want to move around through our canvas in a **non-linear way**, to make the patterns a bit more complex.\n",
|
||||
"\n",
|
||||
"### moving through the canvas\n",
|
||||
"\n",
|
||||
"Each character on our \"canvas\" has a specific position and thus is connected to a `x` and `y` coordinate.\n",
|
||||
"\n",
|
||||
"How can we do that?\n",
|
||||
"\n",
|
||||
"We will use a `list-of-lists`... or in other words: \n",
|
||||
"\n",
|
||||
"we make **one big list**, that contains a # of **rows** (**the `y` axis, or *height* of the canvas**), with a # of **characters** (**the `x` axis, or *width* of the canvas**). \n",
|
||||
"\n",
|
||||
"To make this `list-of-lists`, we will use a `loop-in-a-loop`:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"width = 10\n",
|
||||
"height = 10\n",
|
||||
"\n",
|
||||
"canvas = []\n",
|
||||
"\n",
|
||||
"for y in range(height):\n",
|
||||
" \n",
|
||||
" row = []\n",
|
||||
"\n",
|
||||
" for x in range(width):\n",
|
||||
" row.append(x)\n",
|
||||
" \n",
|
||||
" canvas.append(row)\n",
|
||||
" \n",
|
||||
"print(canvas)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's print the canvas row for row, to make it easier to see it as a x-y canvas:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for row in canvas:\n",
|
||||
" print(row)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"\n",
|
||||
"And let's bring it back into an plain text pattern: turn this `list-of-lists` into a `multiline string`:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# canvas is our list-of-lists\n",
|
||||
"# canvas_string is the plain text version that we want to create\n",
|
||||
"\n",
|
||||
"canvas_string = ''\n",
|
||||
"\n",
|
||||
"for row in canvas:\n",
|
||||
" row_string = ''\n",
|
||||
" for character in row:\n",
|
||||
" row_string += str(character)\n",
|
||||
" canvas_string += row_string + \"\\n\"\n",
|
||||
"\n",
|
||||
"print(canvas_string)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's save this as a function that we can reuse later!"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def plain(canvas):\n",
|
||||
" canvas_string = ''\n",
|
||||
" for row in canvas:\n",
|
||||
" row_string = \"\".join(row)\n",
|
||||
" canvas_string += row_string + \"\\n\"\n",
|
||||
"\n",
|
||||
" return canvas_string"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now, we can work with the `x` and `y` axes of the canvas, by *slicing* the `canvas`:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"canvas[0][0]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"canvas[1][9]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### My first algorithm"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now let's write a short algorithm, to generate a map.\n",
|
||||
"\n",
|
||||
"We will start by writing the **rules** of our algorithm.\n",
|
||||
"\n",
|
||||
"Let's first think of these rules without writing them in code. \n",
|
||||
"\n",
|
||||
"How would you like to generate a pattern?\n",
|
||||
"\n",
|
||||
"For example: \n",
|
||||
"\n",
|
||||
"**Characters**\n",
|
||||
"\n",
|
||||
"* `.` is used as background\n",
|
||||
"* `░` as light shade\n",
|
||||
"* `▒` as darker shade\n",
|
||||
"\n",
|
||||
"**Rules** \n",
|
||||
"\n",
|
||||
"* `░` always appears in horizontal ánd vertical blocks of 3\n",
|
||||
"\n",
|
||||
"```\n",
|
||||
".....\n",
|
||||
"..░..\n",
|
||||
".░░░.\n",
|
||||
"..░..\n",
|
||||
".....\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"* `▒` surrounds the blobs of light shade on the left side of each light shadow \n",
|
||||
"\n",
|
||||
"```\n",
|
||||
".....\n",
|
||||
".▒░..\n",
|
||||
"▒░░░.\n",
|
||||
".▒░..\n",
|
||||
".....\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"Let's try this!"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"First we create a new canvas and fill it with `.`'s."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"width = 100\n",
|
||||
"height = 25\n",
|
||||
"\n",
|
||||
"canvas = []\n",
|
||||
"for y in range(height):\n",
|
||||
" row = []\n",
|
||||
" for x in range(width):\n",
|
||||
" row.append('.')\n",
|
||||
" canvas.append(row)\n",
|
||||
"\n",
|
||||
"print(plain(canvas))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now let's add the light shade..."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from random import randrange\n",
|
||||
"\n",
|
||||
"light_shade = '░'\n",
|
||||
"\n",
|
||||
"for y in range(height):\n",
|
||||
" for x in range(width):\n",
|
||||
" \n",
|
||||
" # To work with a degree of chance, \n",
|
||||
" # we \"roll the dice\" and only add a ░\n",
|
||||
" # when the number is lower then 5\n",
|
||||
" random_number = randrange(0, 100, 1)\n",
|
||||
" if random_number < 3: \n",
|
||||
" \n",
|
||||
" # If so, then we add a ░\n",
|
||||
" canvas[y][x] = light_shade\n",
|
||||
" \n",
|
||||
" # Check is there is a character on the left, right, \n",
|
||||
" # top and bottom AT ALL, before adding them...\n",
|
||||
" if x - 1 >= 0:\n",
|
||||
" canvas[y][x - 1] = light_shade\n",
|
||||
" if x + 1 < width:\n",
|
||||
" canvas[y][x + 1] = light_shade\n",
|
||||
" if y - 1 >= 0:\n",
|
||||
" canvas[y - 1][x] = light_shade\n",
|
||||
" if y + 1 < height:\n",
|
||||
" canvas[y + 1][x] = light_shade\n",
|
||||
" \n",
|
||||
" else:\n",
|
||||
" continue\n",
|
||||
" \n",
|
||||
"print(plain(canvas))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now let's add the darker shade..."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from random import randrange\n",
|
||||
"\n",
|
||||
"light_shade = '░'\n",
|
||||
"darker_shade = '▒'\n",
|
||||
"\n",
|
||||
"for y in range(height):\n",
|
||||
" for x in range(width):\n",
|
||||
" \n",
|
||||
" # First we check if the current character is a light shade\n",
|
||||
" if canvas[y][x] == light_shade:\n",
|
||||
" \n",
|
||||
" # If that is the case, we need to look around, to see if we need to place a shade on the left, right, top or bottom\n",
|
||||
" \n",
|
||||
" # Check is there is a left character AT ALL\n",
|
||||
" if x - 1 >= 0:\n",
|
||||
" # If so, then we check if the left character is a '.'\n",
|
||||
" if canvas[y][x - 1] == '.':\n",
|
||||
" # If so, then we replace it with a dark shade\n",
|
||||
" canvas[y][x - 1] = '▒'\n",
|
||||
" \n",
|
||||
" else:\n",
|
||||
" continue\n",
|
||||
" \n",
|
||||
"print(plain(canvas))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "raw",
|
||||
"metadata": {},
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Could we make a maze generator with the cartographypack now?\n",
|
||||
"\n",
|
||||
":---)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
|
||||
_ _ _ _ __ __ _ _ _ ____ U ___ u __ __ ____ _ _ _____ _ _ ____
|
||||
|'| |'|U |"|u| |U|' \/ '|uU /"\ u | \ |"| U /"___| \/"_ \/U|' \/ '|uU| _"\ uU |"|u| ||_ " _| ___ | \ |"| U /"___|u
|
||||
/| |_| |\\| |\| |\| |\/| |/ \/ _ \/ <| \| |> \| | u | | | |\| |\/| |/\| |_) |/ \| |\| | | | |_"_| <| \| |>\| | _ /
|
||||
U| _ |u | |_| | | | | | / ___ \ U| |\ |u | |/__.-,_| |_| | | | | | | __/ | |_| | /| |\ | | U| |\ |u | |_| |
|
||||
|_| |_| <<\___/ |_| |_| /_/ \_\ |_| \_| \____|\_)-\___/ |_| |_| |_| <<\___/ u |_|U U/| |\u |_| \_| \____|
|
||||
// \\(__) )( <<,-,,-. \\ >> || \\,-. _// \\ \\ <<,-,,-. ||>>_ (__) )( _// \\_.-,_|___|_,-.|| \\,-._)(|_
|
||||
(_") ("_) (__) (./ \.) (__) (__)(_") (_/ (__)(__) (__) (./ \.) (__)__) (__)(__) (__)\_)-' '-(_/ (_") (_/(__)__)
|
||||
|
||||
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . ╓ WALL LIST ╖
|
||||
╟ ╢
|
||||
. . . . . . . . . . . . . . . ╟ ╢
|
||||
╟ ╢
|
||||
. . . . . . . . . . . . . . . ╟ ╢
|
||||
╟ ╢
|
||||
. . . . . . . . . . . . . . . ╟ ╢
|
||||
╟ ╢
|
||||
. . . . . . . . . . . . . . . ╟ ╢
|
||||
╟ ╢
|
||||
. . . . . . . . . . . . . . . ╟ ╢
|
||||
╟ ╢
|
||||
╟ ╢
|
||||
╟ ╢
|
||||
╟ ╢
|
||||
╟ ╢
|
||||
╟ ╢
|
||||
╟ ╢
|
||||
╟ ╢
|
||||
╟ ╢
|
||||
╟ ╢
|
||||
╟ ╢
|
||||
╔═══════════════════════════╗ ╟ ╢
|
||||
║Randomized Prim's Algorithm║ ╟ ╢
|
||||
╚═══════════════════════════╝ ╟ ╢
|
||||
╟ ╢
|
||||
- Start with a grid full of walls. ╟ ╢
|
||||
╟ ╢
|
||||
- Pick a cell, mark it as part of the maze. ╟ ╢
|
||||
Add the walls of the cell to the wall list. ╟ ╢
|
||||
╟ ╢
|
||||
- While there are walls in the list: ╙ ╜
|
||||
|
||||
- Pick a random wall from the list.
|
||||
If only one of the cells that the wall
|
||||
divides is visited, then:
|
||||
|
||||
- Make the wall a passage and mark
|
||||
the unvisited cell as part of
|
||||
the maze.
|
||||
|
||||
- Add the neighboring walls of the
|
||||
cell to the wall list.
|
||||
|
||||
- Remove the wall from the list.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
,. ( . ) . "
|
||||
(" ) )' ,' ) . (` '`
|
||||
.; ) ' (( (" ) ;(, (( ( ;) " )"
|
||||
_"., ,._'_.,)_(..,( . )_ _' )_') (. _..( '..jb
|
||||
|
||||
|
||||
ASCII font "Dancing Font" http://patorjk.com/software/taag/
|
||||
|
||||
Randomized Prim's Algorithm from
|
||||
https://en.wikipedia.org/wiki/Maze_generation_algorithm
|
||||
|
||||
Based on Orestis Zekai's maze generator
|
||||
https://medium.com/swlh/fun-with-python-1-maze-generator-931639b4fb7e
|
||||
|
||||
ASCII fire by jb https://hopemoji.com/text-art-ascii/fire/
|
||||
|
||||
Made in the context of Special Issue 17: Productive Play
|
||||
XPUB™
|
||||
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 519 B After Width: | Height: | Size: 519 B |
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 287 B |
@ -1,129 +0,0 @@
|
||||
|
||||
± ° ° ±
|
||||
Û° ÛÛ± ²ÛÛ °Û
|
||||
ÛÛ ÛÛÛÛ²± ±²ÛÛÛÛ ÛÛ
|
||||
ÛÛÛ ÛÛÛÛÛÛÛ² ²ÛÛÛÛÛÛÛ ÛÛÛ
|
||||
ÛÛÛ² ÛÛÛÛÛÛÛÛÛ²± ±²ÛÛÛÛÛÛÛÛÛ ²ÛÛÛ
|
||||
ÛÛÛÛ± ÛÛÛÛÛÛÛÛÛÛÛÛ² ²ÛÛÛÛÛÛÛÛÛÛÛÛ ²ÛÛÛÛ
|
||||
ÛÛÛÛÛ± ÛÛÛÛÛÛÛÛÛÛÛÛÛÛ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ±ÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛ° ÛÛÛÛÛÛÛÛÛÛÛÛ² ²ÛÛÛÛÛÛÛÛÛÛÛÛ °ÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛ²± ±²ÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛ²² ²²ÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛ ÛÛÛÛ±° °±ÛÛÛÛ ÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛ² ÛÛ± ²ÛÛ ²ÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛ± ° ÜÛÜ ° ±ÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛ° ÛÛÛÛÛ °ÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛ ßÛß ÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ² ÜÛÜ ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ± ÛÛÛÛÛ ±ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ± ßÛß ±ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ° °ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ² ÜÛÜ ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ² ÛÛÛÛÛ ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ± ßÛß ±ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ° °ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ² ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ² ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
|
||||
ÛÛÛ° ÛÛÛÛÛÛÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛÛÛÛÛ°
|
||||
ÛÛÛ° ÛÛÛÛÛÛÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛÛÛÛÛ°
|
||||
ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ°
|
||||
ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ°
|
||||
ÛÛÛ° ÛÛÛ° ÛÛ² ²ÛÛ° ÛÛÛ° ÛÛÛ°
|
||||
ÛÛÛ° ÛÛÛ° ÛÛÛ ÛÛÛ° ÛÛÛ° ÛÛÛ°
|
||||
ÛÛÛ° ÛÛÛ° ÛÛÛÛÛ° ÛÛÛ° ÛÛÛÛÛÛÛ°
|
||||
ÛÛÛ° ÛÛÛ° ÛÛÛÛÛ° ÛÛÛ° ÛÛÛÛÛÛÛ°
|
||||
ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ°
|
||||
ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ°
|
||||
ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ°
|
||||
ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ°
|
||||
ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ°
|
||||
ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛ°
|
||||
ÛÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛÛÛÛÛ° ÛÛÛÛÛÛÛ°
|
||||
ÛÛÛ° ÛÛÛ° ÛÛÛ° ÛÛÛÛÛÛÛ° ÛÛÛÛÛÛÛ°
|
||||
|
||||
ß ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß ß
|
||||
title: C64 TrueType v1.2.1 type: fonts
|
||||
date: April 15, 2019 platform: Any OS/web
|
||||
Ü ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ Ü
|
||||
|
||||
|
||||
>> What the hell is it?
|
||||
|
||||
Our C64 TrueType fonts provide monospace and
|
||||
variable pitch versions of the legendary C64
|
||||
character set. For programmers, each font contains
|
||||
Unicode mappings to accomodate either a direct
|
||||
PETSCII mapping or a screencode mapping. For users,
|
||||
the fonts map to some obvious code points (like the
|
||||
Unicode box drawing range) and should also support
|
||||
easy mapping from applicable code points in cp437
|
||||
and cp1252. Our goal is to provide all 304 necessary
|
||||
glyphs in the C64 character set in as small a file
|
||||
as possible while still being programmer-friendly.
|
||||
Finally, six additional glyphs are included to round
|
||||
out the US-ASCII table with \, ^, `, {, }, and ~ for
|
||||
the sake of providing a usable PETSCII experience
|
||||
in code editors/IDEs.
|
||||
|
||||
This update corrects some bounding box issues as
|
||||
reported in the updated Microsoft Font Validator,
|
||||
left side bearing on one glyph, and updates some
|
||||
PS names.
|
||||
|
||||
This update also adds a 'proper' OpenType format
|
||||
(.otf) with CFF outlines. All files should be
|
||||
smaller than the previous release. SVG format
|
||||
has been dropped.
|
||||
|
||||
"C64 Pro Mono" is the fixed pitch while "C64 Pro"
|
||||
is a variable pitch (propertional) version. In the
|
||||
legacy folder you can also find "C64 Elite Mono"
|
||||
which was used in DirMaster v2.x - we don't
|
||||
recommend using it for anything else other than
|
||||
if you need it for running an older version of
|
||||
DirMaster. The "C64 Pro Mono" in this release is
|
||||
the same as what ships with DirMaster v3.1.2 but
|
||||
will work with any older 3.x version of DirMaster.
|
||||
|
||||
|
||||
>> What does the future hold?
|
||||
|
||||
The Unicode Consortium (or acolytes thereof)
|
||||
recently tackled the issue of missing legacy
|
||||
computing character sets. The first attempt
|
||||
has omitted several of the C64's vertical and
|
||||
horizontal 'quarter-bar' characters. Pending
|
||||
the final outcome we'll add whatever new
|
||||
mappings that are relevant to the C64 when
|
||||
the next Unicode update drops.
|
||||
|
||||
|
||||
>> Previous releases:
|
||||
|
||||
v1.0 - Oct 1, 2010
|
||||
v1.2 - Sep 2, 2014
|
||||
|
||||
|
||||
>> For more information:
|
||||
|
||||
http://style64.org/c64-truetype
|
||||
|
||||
http://style64.org/c64-truetype/license
|
||||
|
||||
http://style64.org/petscii
|
||||
|
||||
|
||||
ß ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß ß
|
||||
Keep scene spirit alive!
|
||||
Ü ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ Ü
|
@ -1,16 +0,0 @@
|
||||
|
||||
ß ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß ß
|
||||
C64 TrueType v1.2.1/Style
|
||||
Ü ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ Ü
|
||||
|
||||
² Û² ²Û ² ßßßßßßßßßßßßßßß
|
||||
Û± ÛÛÛÜ°ÜÛÛÛ ±Û release type:
|
||||
ÛÛ° ÛÛÛß°ßÛÛÛ °ÛÛ þ fonts
|
||||
ÛÛÛ Û² ²Û ÛÛÛ
|
||||
ÛÛÛ² Û ²ÛÛÛ for platform:
|
||||
ÛÛÛÛ± ±ÛÛÛÛ þ Any OS/web
|
||||
ÛÛÛÛÛ° Û °ÛÛÛÛÛ
|
||||
ÛÛÛÛÛÛ ÛÛÛÛÛÛ released on:
|
||||
ÛÛÛÛÛÛÛ Û ÛÛÛÛÛÛÛ þ 2019-04-15
|
||||
ÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛ ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
|
||||
ÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛ úúú[01/01]úúú
|
@ -1,8 +0,0 @@
|
||||
|
||||
Fonts in this package are (c) 2010-2019 Style.
|
||||
|
||||
This license is applicable to each font file included in this package in all their variants (ttf, otf, eot, woff, woff2, svg).
|
||||
|
||||
You MAY NOT: sell this font; include/redistribute the font in any font collection regardless of pricing; provide the font for direct download from any web site, modify or rename the font. You MAY: link to "http://style64.org/c64-truetype" in order for others to download and install the font; embed the font (without any modification or file renaming) for display on any web site using @font-face rules; use this font in static images and vector art; include this font (without any modification or file renaming) as part of a software package but ONLY if said software package is freely provided to end users. You may also contact us to negotiate a (possibly commercial) license for your use outside of these guidelines at "http://style64.org/contact-style".
|
||||
|
||||
At all times the most recent version of this license can be found at "http://style64.org/c64-truetype/license".
|
Before Width: | Height: | Size: 5.9 KiB |
@ -1,170 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title> C64 Pro Mono: EOT (Embedded OpenType) test </title>
|
||||
<style type="text/css">
|
||||
@font-face{font-family:"C64 Pro Mono Local";src:url(../fonts/C64_Pro_Mono-STYLE.eot);src:url(../fonts/C64_Pro_Mono-STYLE.eot?#iefix) format('embedded-opentype')}@font-face{font-family:"C64 Pro Local";src:url(../fonts/C64_Pro-STYLE.eot);src:url(../fonts/C64_Pro-STYLE.eot?#iefix) format('embedded-opentype')}.c64pm{font:normal 24pt/32px "C64 Pro Mono Local",verdana,helvetica,sans-serif;letter-spacing:0;padding:0;margin:0}.c64p{font:normal 24pt/32px "C64 Pro Local",verdana,helvetica,sans-serif;letter-spacing:0;padding:0;margin:0}.px8{font-size:6pt;line-height:8px}.px16{font-size:12pt;line-height:16px}.px24{font-size:18pt;line-height:24px}.px32{font-size:24pt;line-height:32px}.px40{font-size:30pt;line-height:40px}table,td,tr{padding:0;margin:0}tbody,td,thead,tr{background-color:inherit}td{font:inherit;border-right:2px solid #888;border-bottom:2px solid #888}td:first-child{border-left:2px solid #888}tr:first-child td{border-top:2px solid #888}td:hover{background-color:#000!important;color:#fff!important}table{border-top:4px solid #000;border-left:4px solid #000;border-right:4px solid #000;border-bottom:4px solid #000}.d020-00{background-color:#000}.d021-00{color:#000}.d020-06{background-color:#352879}.d021-06{color:#352879}.d020-0e{background-color:#6c5eb5}.d021-0e{color:#6c5eb5}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<div>
|
||||
|
||||
<div class="c64p px16">
|
||||
See: <a href="http://caniuse.com/#feat=eot">http://caniuse.com/#feat=eot</a>
|
||||
<p>If you do not see the font, you may be using a browser that disallows local font loading due to CORS (probably Firefox or IE).</p>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div style="float: left; margin-right: 8px; margin-bottom:16px;">
|
||||
<span class="c64pm px16">“C64 Pro Mono/Style”</span><br/>
|
||||
<span class="c64pm px16"> upper/graphics</span>
|
||||
|
||||
<table cellspacing="0" cellpadding="0" class="c64pm px32 d020-06 d021-0e" style="margin-top: 4px;">
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div style="float: left; margin-right: 8px;">
|
||||
<span class="c64pm px16">“C64 Pro Mono/Style”</span><br/>
|
||||
<span class="c64pm px16"> lower/upper</span>
|
||||
|
||||
<table cellspacing="0" cellpadding="0" class="c64pm px32 d020-06 d021-0e" style="margin-top: 4px;">
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@ -1,170 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title> C64 Pro Mono: OTF (OpenType) test </title>
|
||||
<style type="text/css">
|
||||
@font-face{font-family:"C64 Pro Mono Local";src:url(../fonts/C64_Pro_Mono-STYLE.otf) format("opentype")}@font-face{font-family:"C64 Pro Local";src:url(../fonts/C64_Pro-STYLE.otf) format("opentype")}.c64pm{font:normal 24pt/32px "C64 Pro Mono Local",verdana,helvetica,sans-serif;letter-spacing:0;padding:0;margin:0}.c64p{font:normal 24pt/32px "C64 Pro Local",verdana,helvetica,sans-serif;letter-spacing:0;padding:0;margin:0}.px8{font-size:6pt;line-height:8px}.px16{font-size:12pt;line-height:16px}.px24{font-size:18pt;line-height:24px}.px32{font-size:24pt;line-height:32px}.px40{font-size:30pt;line-height:40px}table,td,tr{padding:0;margin:0}tbody,td,thead,tr{background-color:inherit}td{font:inherit;border-right:2px solid #888;border-bottom:2px solid #888}td:first-child{border-left:2px solid #888}tr:first-child td{border-top:2px solid #888}td:hover{background-color:#000!important;color:#fff!important}table{border-top:4px solid #000;border-left:4px solid #000;border-right:4px solid #000;border-bottom:4px solid #000}.d020-00{background-color:#000}.d021-00{color:#000}.d020-06{background-color:#352879}.d021-06{color:#352879}.d020-0e{background-color:#6c5eb5}.d021-0e{color:#6c5eb5}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<div>
|
||||
|
||||
<div class="c64p px16">
|
||||
See: <a href="http://caniuse.com/#feat=otf">http://caniuse.com/#feat=otf</a>
|
||||
<p>If you do not see the font, you may be using a browser that disallows local font loading due to CORS (probably Firefox or IE).</p>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div style="float: left; margin-right: 8px; margin-bottom:16px;">
|
||||
<span class="c64pm px16">“C64 Pro Mono/Style”</span><br/>
|
||||
<span class="c64pm px16"> upper/graphics</span>
|
||||
|
||||
<table cellspacing="0" cellpadding="0" class="c64pm px32 d020-06 d021-0e" style="margin-top: 4px;">
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div style="float: left; margin-right: 8px;">
|
||||
<span class="c64pm px16">“C64 Pro Mono/Style”</span><br/>
|
||||
<span class="c64pm px16"> lower/upper</span>
|
||||
|
||||
<table cellspacing="0" cellpadding="0" class="c64pm px32 d020-06 d021-0e" style="margin-top: 4px;">
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@ -1,169 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title> C64 Pro Mono: TTF (TrueType) test </title>
|
||||
<style type="text/css">
|
||||
@font-face{font-family:"C64 Pro Mono Local";src:url(../fonts/C64_Pro_Mono-STYLE.ttf) format("truetype")}@font-face{font-family:"C64 Pro Local";src:url(../fonts/C64_Pro-STYLE.ttf) format("truetype")}.c64pm{font:normal 24pt/32px "C64 Pro Mono Local",verdana,helvetica,sans-serif;letter-spacing:0;padding:0;margin:0}.c64p{font:normal 24pt/32px "C64 Pro Local",verdana,helvetica,sans-serif;letter-spacing:0;padding:0;margin:0}.px8{font-size:6pt;line-height:8px}.px16{font-size:12pt;line-height:16px}.px24{font-size:18pt;line-height:24px}.px32{font-size:24pt;line-height:32px}.px40{font-size:30pt;line-height:40px}table,td,tr{padding:0;margin:0}tbody,td,thead,tr{background-color:inherit}td{font:inherit;border-right:2px solid #888;border-bottom:2px solid #888}td:first-child{border-left:2px solid #888}tr:first-child td{border-top:2px solid #888}td:hover{background-color:#000!important;color:#fff!important}table{border-top:4px solid #000;border-left:4px solid #000;border-right:4px solid #000;border-bottom:4px solid #000}.d020-00{background-color:#000}.d021-00{color:#000}.d020-06{background-color:#352879}.d021-06{color:#352879}.d020-0e{background-color:#6c5eb5}.d021-0e{color:#6c5eb5}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<div>
|
||||
|
||||
<div class="c64p px16">
|
||||
See: <a href="http://caniuse.com/#feat=ttf">http://caniuse.com/#feat=ttf</a>
|
||||
<p>If you do not see the font, you may be using a browser that disallows local font loading due to CORS (probably Firefox or IE).</p>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div style="float: left; margin-right: 8px; margin-bottom:16px;">
|
||||
<span class="c64pm px16">“C64 Pro Mono/Style”</span><br/>
|
||||
<span class="c64pm px16"> upper/graphics</span>
|
||||
|
||||
<table cellspacing="0" cellpadding="0" class="c64pm px32 d020-06 d021-0e" style="margin-top: 4px;">
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div style="float: left; margin-right: 8px;">
|
||||
<span class="c64pm px16">“C64 Pro Mono/Style”</span><br/>
|
||||
<span class="c64pm px16"> lower/upper</span>
|
||||
|
||||
<table cellspacing="0" cellpadding="0" class="c64pm px32 d020-06 d021-0e" style="margin-top: 4px;">
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,170 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title> C64 Pro Mono: WOFF (Web Open Font Format) test </title>
|
||||
<style type="text/css">
|
||||
@font-face{font-family:"C64 Pro Mono Local";src:url(../fonts/C64_Pro_Mono-STYLE.woff) format("woff")}@font-face{font-family:"C64 Pro Local";src:url(../fonts/C64_Pro-STYLE.woff) format("woff")}.c64pm{font:normal 24pt/32px "C64 Pro Mono Local",verdana,helvetica,sans-serif;letter-spacing:0;padding:0;margin:0}.c64p{font:normal 24pt/32px "C64 Pro Local",verdana,helvetica,sans-serif;letter-spacing:0;padding:0;margin:0}.px8{font-size:6pt;line-height:8px}.px16{font-size:12pt;line-height:16px}.px24{font-size:18pt;line-height:24px}.px32{font-size:24pt;line-height:32px}.px40{font-size:30pt;line-height:40px}table,td,tr{padding:0;margin:0}tbody,td,thead,tr{background-color:inherit}td{font:inherit;border-right:2px solid #888;border-bottom:2px solid #888}td:first-child{border-left:2px solid #888}tr:first-child td{border-top:2px solid #888}td:hover{background-color:#000!important;color:#fff!important}table{border-top:4px solid #000;border-left:4px solid #000;border-right:4px solid #000;border-bottom:4px solid #000}.d020-00{background-color:#000}.d021-00{color:#000}.d020-06{background-color:#352879}.d021-06{color:#352879}.d020-0e{background-color:#6c5eb5}.d021-0e{color:#6c5eb5}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<div>
|
||||
|
||||
<div class="c64p px16">
|
||||
See: <a href="http://caniuse.com/#feat=woff">http://caniuse.com/#feat=woff</a>
|
||||
<p>If you do not see the font, you may be using a browser that disallows local font loading due to CORS (probably Firefox or IE).</p>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div style="float: left; margin-right: 8px; margin-bottom:16px;">
|
||||
<span class="c64pm px16">“C64 Pro Mono/Style”</span><br/>
|
||||
<span class="c64pm px16"> upper/graphics</span>
|
||||
|
||||
<table cellspacing="0" cellpadding="0" class="c64pm px32 d020-06 d021-0e" style="margin-top: 4px;">
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div style="float: left; margin-right: 8px;">
|
||||
<span class="c64pm px16">“C64 Pro Mono/Style”</span><br/>
|
||||
<span class="c64pm px16"> lower/upper</span>
|
||||
|
||||
<table cellspacing="0" cellpadding="0" class="c64pm px32 d020-06 d021-0e" style="margin-top: 4px;">
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@ -1,170 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title> C64 Pro Mono: WOFF2 (Web Open Font Format 2.0) test </title>
|
||||
<style type="text/css">
|
||||
@font-face{font-family:"C64 Pro Mono Local";src:url(../fonts/C64_Pro_Mono-STYLE.woff2) format("woff2")}@font-face{font-family:"C64 Pro Local";src:url(../fonts/C64_Pro-STYLE.woff2) format("woff2")}.c64pm{font:normal 24pt/32px "C64 Pro Mono Local",verdana,helvetica,sans-serif;letter-spacing:0;padding:0;margin:0}.c64p{font:normal 24pt/32px "C64 Pro Local",verdana,helvetica,sans-serif;letter-spacing:0;padding:0;margin:0}.px8{font-size:6pt;line-height:8px}.px16{font-size:12pt;line-height:16px}.px24{font-size:18pt;line-height:24px}.px32{font-size:24pt;line-height:32px}.px40{font-size:30pt;line-height:40px}table,tr,td{padding:0;margin:0}thead,tbody,tr,td{background-color:inherit}td{font:inherit;border-right:2px solid #888;border-bottom:2px solid #888}td:first-child{border-left:2px solid #888}tr:first-child td{border-top:2px solid #888}td:hover{background-color:#000!important;color:#fff!important}table{border-top:4px solid #000;border-left:4px solid #000;border-right:4px solid #000;border-bottom:4px solid #000}.d020-00{background-color:#000}.d021-00{color:#000}.d020-06{background-color:#352879}.d021-06{color:#352879}.d020-0e{background-color:#6C5EB5}.d021-0e{color:#6C5EB5}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<div>
|
||||
|
||||
<div class="c64p px16">
|
||||
See: <a href="http://caniuse.com/#feat=woff2">http://caniuse.com/#feat=woff2</a>
|
||||
<p>If you do not see the font, you may be using a browser that disallows local font loading due to CORS (probably Firefox or IE).</p>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div style="float: left; margin-right: 8px; margin-bottom:16px;">
|
||||
<span class="c64pm px16">“C64 Pro Mono/Style”</span><br/>
|
||||
<span class="c64pm px16"> upper/graphics</span>
|
||||
|
||||
<table cellspacing="0" cellpadding="0" class="c64pm px32 d020-06 d021-0e" style="margin-top: 4px;">
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div style="float: left; margin-right: 8px;">
|
||||
<span class="c64pm px16">“C64 Pro Mono/Style”</span><br/>
|
||||
<span class="c64pm px16"> lower/upper</span>
|
||||
|
||||
<table cellspacing="0" cellpadding="0" class="c64pm px32 d020-06 d021-0e" style="margin-top: 4px;">
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
<td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@ -1,158 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Generating mini-games with random.choice()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
". . . . .. . . .. \n",
|
||||
" . . . . . . . . . . . \n",
|
||||
" . . . .. .. . . .\n",
|
||||
" . . . . . . . . \n",
|
||||
" . . . . . . . . . . \n",
|
||||
" . . . . . . . . . \n",
|
||||
" . . . . . . .. \n",
|
||||
" . . . .. . . . . .. . .. \n",
|
||||
" . . . . . . . .. . \n",
|
||||
". . . . . . . . .. . \n",
|
||||
". . . .. . . \n",
|
||||
" . . . . . . . .. . \n",
|
||||
" . . . . . \n",
|
||||
" . . . . . . . \n",
|
||||
" . . . . . . . .\n",
|
||||
". . . .. . . . . . \n",
|
||||
" .. . . . . \n",
|
||||
" . . . . . . . . . . . \n",
|
||||
" . . . . . . . .. \n",
|
||||
" . . . . . \n",
|
||||
" . . . . . . . . . . . . \n",
|
||||
" . . . . . . . . . . . \n",
|
||||
" . . . . . . . . . . \n",
|
||||
" . . . . . . . . . \n",
|
||||
" . . . . . . . . . \n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from random import choice\n",
|
||||
"\n",
|
||||
"characters = ['.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']\n",
|
||||
"width = 100\n",
|
||||
"height = 25\n",
|
||||
"\n",
|
||||
"for y in range(height):\n",
|
||||
" for x in range(width):\n",
|
||||
" print(choice(characters), end='')\n",
|
||||
" print('')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 130,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" a o it m i i m f c \n",
|
||||
" c i ag n o amf f o i \n",
|
||||
" o i o f i a g af i g\n",
|
||||
" m i f a t g c f t i\n",
|
||||
" n o f a f tnf o f \n",
|
||||
" a i i i i i t in c caa \n",
|
||||
" t fa n f i t a i o\n",
|
||||
" o i ag ig g g a i i i n ag \n",
|
||||
" n m gt a i o f i o ni i i \n",
|
||||
" m i f i a a a o i m a g c \n",
|
||||
" f am a c o i f cna f mi\n",
|
||||
" t a i c f g f n i c o o g \n",
|
||||
" o f t a g ng i a i a n n o a t oi i it\n",
|
||||
" o t n o m f g a i a m ni \n",
|
||||
" f i i g m o i a n t a i a a m i a i a\n",
|
||||
"i a a ac i a t i tn t a \n",
|
||||
" o f tf i an i n o f i t t \n",
|
||||
" c g fg i o o ca i o o o m t \n",
|
||||
" f o i i i c i ta i ca c f \n",
|
||||
" c n aa g i m g m i c \n",
|
||||
" c i c i f i n m f i i \n",
|
||||
" a o i g m o ot a i a c f m i \n",
|
||||
" i a a i f f a c g i\n",
|
||||
" to in a t og im i o i f n c \n",
|
||||
"ao m g ii c n a to t \n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from random import choice\n",
|
||||
"\n",
|
||||
"character_set = 'gamification '\n",
|
||||
"characters = [character for character in character_set]\n",
|
||||
"width = 100\n",
|
||||
"height = 25\n",
|
||||
"\n",
|
||||
"for y in range(height):\n",
|
||||
" for x in range(width):\n",
|
||||
" print(choice(characters), end='')\n",
|
||||
" print('')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# More games plz!"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Try to make some more mini-games yourself.\n",
|
||||
"\n",
|
||||
"You can restrict yourself to using **ASCII characters only** (see https://en.wikipedia.org/wiki/ASCII) and stay in touch with early computer graphics ASCII art...\n",
|
||||
"\n",
|
||||
"Or you can extend your pallete with **Unicode characters**. This is a nice website that highlights specific character sets: http://xahlee.info/comp/unicode_index.html"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
@ -0,0 +1,313 @@
|
||||
# make_wordsearch.py
|
||||
import os
|
||||
import sys
|
||||
import random
|
||||
from copy import deepcopy
|
||||
|
||||
# Maximum number of rows and columns.
|
||||
NMAX = 32
|
||||
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
|
||||
def circle_mask(grid):
|
||||
"""A circular mask to shape the grid."""
|
||||
r2 = min(ncols, nrows)**2 // 4
|
||||
cx, cy = ncols//2, nrows // 2
|
||||
for irow in range(nrows):
|
||||
for icol in range(ncols):
|
||||
if (irow - cy)**2 + (icol - cx)**2 > r2:
|
||||
grid[irow][icol] = '*'
|
||||
|
||||
def squares_mask(grid):
|
||||
"""A mask of overlapping squares to shape the grid."""
|
||||
a = int(0.38 * min(ncols, nrows))
|
||||
cy = nrows // 2
|
||||
cx = ncols // 2
|
||||
for irow in range(nrows):
|
||||
for icol in range(ncols):
|
||||
if a <= icol < ncols-a:
|
||||
if irow < cy-a or irow > cy+a:
|
||||
grid[irow][icol] = '*'
|
||||
if a <= irow < nrows-a:
|
||||
if icol < cx-a or icol > cx+a:
|
||||
grid[irow][icol] = '*'
|
||||
|
||||
def no_mask(grid):
|
||||
"""The default, no mask."""
|
||||
pass
|
||||
|
||||
# A dictionary of masking functions, keyed by their name.
|
||||
apply_mask = {
|
||||
None: no_mask,
|
||||
'circle': circle_mask,
|
||||
'squares': squares_mask,
|
||||
}
|
||||
|
||||
def make_grid(mask=None):
|
||||
"""Make the grid and apply a mask (locations a letter cannot be placed)."""
|
||||
grid = [[' ']*ncols for _ in range(nrows)]
|
||||
apply_mask[mask](grid)
|
||||
return grid
|
||||
|
||||
def _make_wordsearch(nrows, ncols, wordlist, allow_backwards_words=True,
|
||||
mask=None):
|
||||
"""Attempt to make a word search with the given parameters."""
|
||||
|
||||
grid = make_grid(mask)
|
||||
|
||||
def fill_grid_randomly(grid):
|
||||
"""Fill up the empty, unmasked positions with random letters."""
|
||||
for irow in range(nrows):
|
||||
for icol in range(ncols):
|
||||
if grid[irow][icol] == ' ':
|
||||
grid[irow][icol] = random.choice(alphabet)
|
||||
|
||||
def remove_mask(grid):
|
||||
"""Remove the mask, for text output, by replacing with whitespace."""
|
||||
for irow in range(nrows):
|
||||
for icol in range(ncols):
|
||||
if grid[irow][icol] == '*':
|
||||
grid[irow][icol] = ' '
|
||||
|
||||
|
||||
def test_candidate(irow, icol, dx, dy, word):
|
||||
"""Test the candidate location (icol, irow) for word in orientation
|
||||
dx, dy)."""
|
||||
for j in range(len(word)):
|
||||
if grid[irow][icol] not in (' ', word[j]):
|
||||
return False
|
||||
irow += dy
|
||||
icol += dx
|
||||
return True
|
||||
|
||||
def place_word(word):
|
||||
"""Place word randomly in the grid and return True, if possible."""
|
||||
|
||||
# Left, down, and the diagonals.
|
||||
dxdy_choices = [(0,1), (1,0), (1,1), (1,-1)]
|
||||
random.shuffle(dxdy_choices)
|
||||
for (dx, dy) in dxdy_choices:
|
||||
if allow_backwards_words and random.choice([True, False]):
|
||||
# If backwards words are allowed, simply reverse word.
|
||||
word = word[::-1]
|
||||
# Work out the minimum and maximum column and row indexes, given
|
||||
# the word length.
|
||||
n = len(word)
|
||||
colmin = 0
|
||||
colmax = ncols - n if dx else ncols - 1
|
||||
rowmin = 0 if dy >= 0 else n - 1
|
||||
rowmax = nrows - n if dy >= 0 else nrows - 1
|
||||
if colmax - colmin < 0 or rowmax - rowmin < 0:
|
||||
# No possible place for the word in this orientation.
|
||||
continue
|
||||
# Build a list of candidate locations for the word.
|
||||
candidates = []
|
||||
for irow in range(rowmin, rowmax+1):
|
||||
for icol in range(colmin, colmax+1):
|
||||
if test_candidate(irow, icol, dx, dy, word):
|
||||
candidates.append((irow, icol))
|
||||
# If we don't have any candidates, try the next orientation.
|
||||
if not candidates:
|
||||
continue
|
||||
# Pick a random candidate location and place the word in this
|
||||
# orientation.
|
||||
loc = irow, icol = random.choice(candidates)
|
||||
for j in range(n):
|
||||
grid[irow][icol] = word[j]
|
||||
irow += dy
|
||||
icol += dx
|
||||
# We're done: no need to try any more orientations.
|
||||
break
|
||||
else:
|
||||
# If we're here, it's because we tried all orientations but
|
||||
# couldn't find anywhere to place the word. Oh dear.
|
||||
return False
|
||||
print(word, loc, (dx, dy))
|
||||
return True
|
||||
|
||||
# Iterate over the word list and try to place each word (without spaces).
|
||||
for word in wordlist:
|
||||
word = word.replace(' ', '')
|
||||
if not place_word(word):
|
||||
# We failed to place word, so bail.
|
||||
return None, None
|
||||
|
||||
# grid is a list of lists, so we need to deepcopy here for an independent
|
||||
# copy to keep as the solution (without random letters in unfilled spots).
|
||||
solution = deepcopy(grid)
|
||||
fill_grid_randomly(grid)
|
||||
remove_mask(grid)
|
||||
remove_mask(solution)
|
||||
|
||||
return grid, solution
|
||||
|
||||
|
||||
def make_wordsearch(*args, **kwargs):
|
||||
"""Make a word search, attempting to fit words into the specified grid."""
|
||||
|
||||
# We try NATTEMPTS times (with random orientations) before giving up.
|
||||
NATTEMPTS = 10
|
||||
for i in range(NATTEMPTS):
|
||||
grid, solution = _make_wordsearch(*args, **kwargs)
|
||||
if grid:
|
||||
print('Fitted the words in {} attempt(s)'.format(i+1))
|
||||
return grid, solution
|
||||
print('I failed to place all the words after {} attempts.'
|
||||
.format(NATTEMPTS))
|
||||
return None, None
|
||||
|
||||
|
||||
def show_grid_text(grid):
|
||||
"""Output a text version of the filled grid wordsearch."""
|
||||
for irow in range(nrows):
|
||||
print(' '.join(grid[irow]))
|
||||
|
||||
def show_wordlist_text(wordlist):
|
||||
"""Output a text version of the list of the words to find."""
|
||||
for word in wordlist:
|
||||
print(word)
|
||||
|
||||
def show_wordsearch_text(grid, wordlist):
|
||||
"""Output the wordsearch grid and list of words to find."""
|
||||
show_grid_text(grid)
|
||||
print()
|
||||
show_wordlist_text(wordlist)
|
||||
|
||||
|
||||
def svg_preamble(fo, width, height):
|
||||
"""Output the SVG preamble, with styles, to open file object fo."""
|
||||
|
||||
print("""<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" width="{}" height="{}" >
|
||||
<defs>
|
||||
<style type="text/css"><![CDATA[
|
||||
line, path {{
|
||||
stroke: black;
|
||||
stroke-width: 4;
|
||||
stroke-linecap: square;
|
||||
}}
|
||||
path {{
|
||||
fill: none;
|
||||
}}
|
||||
|
||||
text {{
|
||||
font: bold 24px Verdana, Helvetica, Arial, sans-serif;
|
||||
}}
|
||||
|
||||
]]>
|
||||
</style>
|
||||
</defs>
|
||||
""".format(width, height), file=fo)
|
||||
|
||||
def grid_as_svg(grid, width, height):
|
||||
"""Return the wordsearch grid as a sequence of SVG <text> elements."""
|
||||
|
||||
# A bit of padding at the top.
|
||||
YPAD = 20
|
||||
# There is some (not much) wiggle room to squeeze in wider grids by
|
||||
# reducing the letter spacing.
|
||||
letter_width = min(32, width / ncols)
|
||||
grid_width = letter_width * ncols
|
||||
# The grid is centred; this is the padding either side of it.
|
||||
XPAD = (width - grid_width) / 2
|
||||
letter_height = letter_width
|
||||
grid_height = letter_height * nrows
|
||||
s = []
|
||||
|
||||
# Output the grid, one letter at a time, keeping track of the y-coord.
|
||||
y = YPAD + letter_height / 2
|
||||
for irow in range(nrows):
|
||||
x = XPAD + letter_width / 2
|
||||
for icol in range(ncols):
|
||||
letter = grid[irow][icol]
|
||||
if letter != ' ':
|
||||
s.append('<text x="{}" y="{}" text-anchor="middle">{}</text>'
|
||||
.format(x, y, letter))
|
||||
x += letter_width
|
||||
y += letter_height
|
||||
|
||||
# We return the last y-coord used, to decide where to put the word list.
|
||||
return y, '\n'.join(s)
|
||||
|
||||
def wordlist_svg(wordlist, width, height, y0):
|
||||
"""Return a list of the words to find as a sequence of <text> elements."""
|
||||
|
||||
# Use two columns of words to save (some) space.
|
||||
n = len(wordlist)
|
||||
col1, col2 = wordlist[:n//2], wordlist[n//2:]
|
||||
|
||||
def word_at(x, y, word):
|
||||
"""The SVG element for word centred at (x, y)."""
|
||||
return ( '<text x="{}" y="{}" text-anchor="middle" class="wordlist">'
|
||||
'{}</text>'.format(x, y, word) )
|
||||
|
||||
s = []
|
||||
x = width * 0.25
|
||||
# Build the list of <text> elements for each column of words.
|
||||
y0 += 25
|
||||
for i, word in enumerate(col1):
|
||||
s.append(word_at(x, y0 + 25*i, word))
|
||||
x = width * 0.75
|
||||
for i, word in enumerate(col2):
|
||||
s.append(word_at(x, y0 + 25*i, word))
|
||||
return '\n'.join(s)
|
||||
|
||||
def write_wordsearch_svg(filename, grid, wordlist):
|
||||
"""Save the wordsearch grid as an SVG file to filename."""
|
||||
|
||||
width, height = 1000, 1414
|
||||
with open(filename, 'w') as fo:
|
||||
svg_preamble(fo, width, height)
|
||||
y0, svg_grid = grid_as_svg(grid, width, height)
|
||||
print(svg_grid, file=fo)
|
||||
# If there's room print the word list.
|
||||
if y0 + 25 * len(wordlist) // 2 < height:
|
||||
print(wordlist_svg(wordlist, width, height, y0), file=fo)
|
||||
print('</svg>', file=fo)
|
||||
|
||||
|
||||
def get_wordlist(wordlist_filename):
|
||||
"""Read in the word list from wordlist_filename."""
|
||||
wordlist = []
|
||||
with open(wordlist_filename) as fi:
|
||||
for line in fi:
|
||||
# The word is upper-cased and comments and blank lines are ignored.
|
||||
line = line.strip().upper()
|
||||
if not line or line.startswith('#'):
|
||||
continue
|
||||
wordlist.append(line)
|
||||
return wordlist
|
||||
|
||||
# Read the wordlist filename and grid dimensions (nrows, ncols) from the
|
||||
# command line.
|
||||
wordlist_filename = sys.argv[1]
|
||||
nrows, ncols = int(sys.argv[2]), int(sys.argv[3])
|
||||
mask = None
|
||||
if len(sys.argv) > 4:
|
||||
mask = sys.argv[4]
|
||||
if nrows > NMAX or ncols > NMAX:
|
||||
sys.exit('Maximum number of rows and columns is {}'.format(NMAX))
|
||||
wordlist = sorted(get_wordlist(wordlist_filename), key=lambda w: len(w),
|
||||
reverse=True)
|
||||
# Obviously, no word can be longer than the maximum dimension.
|
||||
max_word_len = max(nrows, ncols)
|
||||
if max(len(word) for word in wordlist) > max_word_len:
|
||||
raise ValueError('Word list contains a word with too many letters.'
|
||||
'The maximum is {}'.format(max(nrows, ncols)))
|
||||
|
||||
# This flag determines whether words can be fitted backwards into the grid
|
||||
# (which makes the puzzle a bit harder).
|
||||
allow_backwards_words = False
|
||||
# If using a mask, specify it by a key to the apply_mask dictionary.
|
||||
grid, solution = make_wordsearch(nrows, ncols, wordlist, allow_backwards_words,
|
||||
mask)
|
||||
|
||||
# If we fitted the words to the grid, show it in text format and save SVG files
|
||||
# of the grid and its solution.
|
||||
if grid:
|
||||
show_wordsearch_text(grid, wordlist)
|
||||
filename = os.path.splitext(wordlist_filename)[0] + '.svg'
|
||||
write_wordsearch_svg(filename, grid, wordlist)
|
||||
filename = os.path.splitext(wordlist_filename)[0] + '-solution.svg'
|
||||
write_wordsearch_svg(filename, solution, [])
|
||||
|
@ -0,0 +1,86 @@
|
||||
. .. . . . .
|
||||
. . .. . . . . .. .
|
||||
. . . . . . . . . . . .. .
|
||||
. . . . . . . .. .
|
||||
. . . . . .. .. . . .
|
||||
. . . . .
|
||||
. . . . . ..
|
||||
. . . . .
|
||||
. . . . . . . .
|
||||
. . . . . . .. . . . . . .
|
||||
. . . . . . . . . . .. .. .
|
||||
. . . .. . . . . .
|
||||
. . . . . . . . .
|
||||
... . . . . . . . .. . .. .
|
||||
.. . . . ... . . . .
|
||||
. . . . .
|
||||
. . . . . . . . . . ..
|
||||
. . . . .. . .. .. .. . .
|
||||
. . . . . . . . .
|
||||
. . . . .. .
|
||||
. . . . .. . . .. . ..
|
||||
. .. . . . .
|
||||
.. . . . .
|
||||
. . . . . . . .. .
|
||||
. . . . . . . . . .
|
||||
. .. . . . .
|
||||
. . .. . . . . .. .
|
||||
. . . . . . . . . . . .. .
|
||||
. . . . . . . .. .
|
||||
. . . . . .. .. . . .
|
||||
. . . . .
|
||||
. . . . . ..
|
||||
. . . . .
|
||||
. . . . . . . .
|
||||
. . . . . . .. . . . . . .
|
||||
. . . . . . . . . . .. .. .
|
||||
. . . .. . . . . .
|
||||
. . . . . . . . .
|
||||
... . . . . . . . .. . .. .
|
||||
.. . . . ... . . . .
|
||||
. . . . .
|
||||
. . . . . . . . . . ..
|
||||
. . . . .. . .. .. .. . .
|
||||
. . . . . . . . .
|
||||
. . . . .. .
|
||||
. . . . .. . . .. . ..
|
||||
. .. . . . .
|
||||
.. . . . .
|
||||
. . . . . . . .. .
|
||||
. . . . . . . . . .
|
||||
|
||||
. . . . .
|
||||
. . . . . ..
|
||||
. . . . .
|
||||
. . . . . . . .
|
||||
. . . . . . .. . . . . . .
|
||||
. . . . . . . . . . .. .. .
|
||||
. . . .. . . . . .
|
||||
. . . . . . . . .
|
||||
... . . . . . . . .. . .. .
|
||||
.. . . . ... . . . .
|
||||
. . . . .
|
||||
. . . . . . . . . . ..
|
||||
. . . . .. . .. .. .. . .
|
||||
. . . . . . . . .
|
||||
. . . . .. .
|
||||
. . . . .. . . .. . ..
|
||||
. .. . . . .
|
||||
.. . . . .
|
||||
. . . . . . . .. .
|
||||
. . . . . . . . . .
|
||||
. .. . . . .
|
||||
. . .. . . . . .. .
|
||||
. . . . . . . . . . . .. .
|
||||
. . . . . . . .. .
|
||||
. . . . . .. .. . . .
|
||||
. . . . .
|
||||
. . . . . ..
|
||||
. . . . .
|
||||
. . . . . . . .
|
||||
. . . . . . .. . . . . . .
|
||||
. . . . . . . . . . .. .. .
|
||||
. . . .. . . . . .
|
||||
. . . . . . . . .
|
||||
... . . . . . . . .. . .. .
|
||||
.. . . . ... . . . .
|
@ -0,0 +1,368 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Generating mini-puzzles with random.choice()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Dots-and-boxes & Connect the dots & ... ?\n",
|
||||
"\n",
|
||||
"![](https://upload.wikimedia.org/wikipedia/commons/b/b7/Dots-and-boxes-chains.png)\n",
|
||||
"\n",
|
||||
"![](https://upload.wikimedia.org/wikipedia/commons/thumb/d/d8/Connect_the_dots_puzzle_%28partially_solved%29.png/400px-Connect_the_dots_puzzle_%28partially_solved%29.png)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" . . . . . . \n",
|
||||
" . . . .. . \n",
|
||||
" . . . . . . . \n",
|
||||
" . . . . . . . . .. \n",
|
||||
" . . . . . . . . . .\n",
|
||||
" . . . .. . . . . . \n",
|
||||
" . . . . . \n",
|
||||
" . . . . . . \n",
|
||||
" . .. . . . \n",
|
||||
" . . . .. . . . \n",
|
||||
" . . . . . . . \n",
|
||||
". . . . . . . . \n",
|
||||
" . . . . .. .. . . . \n",
|
||||
" . . . . . . . . . . . . . \n",
|
||||
" . . . . . . \n",
|
||||
" . ... . .. . . . . . . . . . .. \n",
|
||||
" . . . . . . . . . \n",
|
||||
" . . ... .. . .. . . . . . . \n",
|
||||
" . . . . .. . . ... . \n",
|
||||
" . . . . . . . . . . \n",
|
||||
" . . . . . . . .. . . . .. \n",
|
||||
" . . . . . . . . \n",
|
||||
". . . . . . . . .. . . . . . \n",
|
||||
" . . . .. .\n",
|
||||
" . . .. . . . . . . . \n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from random import choice\n",
|
||||
"\n",
|
||||
"characters = ['.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']\n",
|
||||
"width = 100\n",
|
||||
"height = 25\n",
|
||||
"\n",
|
||||
"for y in range(height):\n",
|
||||
" for x in range(width):\n",
|
||||
" print(choice(characters), end='')\n",
|
||||
" print('')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Generate a \"Connect the dots\" with jp2a"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"![](play.jpg)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"scrolled": true,
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"jp2a 1.0.6\n",
|
||||
"Copyright (C) 2006 Christian Stigen Larsen\n",
|
||||
"Distributed under the GNU General Public License (GPL) v2.\n",
|
||||
"\n",
|
||||
"Usage: jp2a [ options ] [ file(s) | URL(s) ]\n",
|
||||
"\n",
|
||||
"Convert files or URLs from JPEG format to ASCII.\n",
|
||||
"\n",
|
||||
"OPTIONS\n",
|
||||
" - Read images from standard input.\n",
|
||||
" --blue=N.N Set RGB to grayscale conversion weight, default is 0.1145\n",
|
||||
" -b, --border Print a border around the output image.\n",
|
||||
" --chars=... Select character palette used to paint the image.\n",
|
||||
" Leftmost character corresponds to black pixel, right-\n",
|
||||
" most to white. Minimum two characters must be specified.\n",
|
||||
" --clear Clears screen before drawing each output image.\n",
|
||||
" --colors Use ANSI colors in output.\n",
|
||||
" -d, --debug Print additional debug information.\n",
|
||||
" --fill When used with --color and/or --html, color each character's\n",
|
||||
" background color.\n",
|
||||
" -x, --flipx Flip image in X direction.\n",
|
||||
" -y, --flipy Flip image in Y direction.\n",
|
||||
" -f, --term-fit Use the largest image dimension that fits in your terminal\n",
|
||||
" display with correct aspect ratio.\n",
|
||||
" --term-height Use terminal display height.\n",
|
||||
" --term-width Use terminal display width.\n",
|
||||
" -z, --term-zoom Use terminal display dimension for output.\n",
|
||||
" --grayscale Convert image to grayscale when using --html or --colors\n",
|
||||
" --green=N.N Set RGB to grayscale conversion weight, default is 0.5866\n",
|
||||
" --height=N Set output height, calculate width from aspect ratio.\n",
|
||||
" -h, --help Print program help.\n",
|
||||
" --html Produce strict XHTML 1.0 output.\n",
|
||||
" --html-fill Same as --fill (will be phased out)\n",
|
||||
" --html-fontsize=N Set fontsize to N pt, default is 4.\n",
|
||||
" --html-no-bold Do not use bold characters with HTML output\n",
|
||||
" --html-raw Output raw HTML codes, i.e. without the <head> section etc.\n",
|
||||
" --html-title=... Set HTML output title\n",
|
||||
" -i, --invert Invert output image. Use if your display has a dark\n",
|
||||
" background.\n",
|
||||
" --background=dark These are just mnemonics whether to use --invert\n",
|
||||
" --background=light or not. If your console has light characters on\n",
|
||||
" a dark background, use --background=dark.\n",
|
||||
" --output=... Write output to file.\n",
|
||||
" --red=N.N Set RGB to grayscale conversion weight, default 0.2989f.\n",
|
||||
" --size=WxH Set output width and height.\n",
|
||||
" -v, --verbose Verbose output.\n",
|
||||
" -V, --version Print program version.\n",
|
||||
" --width=N Set output width, calculate height from ratio.\n",
|
||||
"\n",
|
||||
" The default mode is `jp2a --term-fit --background=dark'.\n",
|
||||
" See the man-page for jp2a for more detailed help text.\n",
|
||||
"\n",
|
||||
"Project homepage on http://jp2a.sf.net\n",
|
||||
"Report bugs to <csl@sublevel3.org>\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"! jp2a --help"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n",
|
||||
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n",
|
||||
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n",
|
||||
"MMMMMMWMMMMMMMMMMMMMMMMMMMMWNMMNNWMMMMNWNNMMMMMMMMMMMMMMMMWMMMMMMMMWMMMMMMMMKNNWMMMMMMMMMMMMMMMMMMMM\n",
|
||||
"MMKdWWNXMMMxNWNNWNNONNNWNNNNWokWMNNXNNNMMWNXMMMMMMMMM0NNNNXNNNNoXWWKMMMMMMMdKMMNXMMM00NXWMMM00NNNMMM\n",
|
||||
"MM0oMMMNMMM;NMMMMMM;KXWMMMMXXKcMMxkMMMNXkkXMMMMMMMMMMcMMMMXNMMW:XMMNMMMMMMOkMMMMNXXONMMMNNNkXMMMXNMM\n",
|
||||
"MMXlMMMNMMMcXMX00KXNXkxMMMWXMM00KKoOXMWNNNNNMMMMMMMMMcMMMXNxxMW:0MMNMMMMMXdMMKlMMNox0MMMMMXMMMWXWMMM\n",
|
||||
"MMNcMMMNWWN,0MMXXNMMM0xMMMXWMMMMMMMKK00oWMMWNMMMMMMMMcMMMWWXWNXx0MMWWWWNXoWMMKcKMMNXKxxKMMMMMNNMMMMM\n",
|
||||
"MMMlMMMMMMM,0MMWWWNNM0kMMMXMMMMMMWdNNNNXMMMMXMMMMMMMMcMMMMXXNMMkkMMMMMMMcXMMMMMMMMMNNMMcMMMMMNMMMMMM\n",
|
||||
"MMMcMMWWWXN:kNXXXXXWMKd0KWXMMMMMMoOMMMMMMWNXMMMMMMMMMcMMMMXMMMMOxMWWWNXNlKMMNXXcXMNNNMMcNWWWMNMMMMMM\n",
|
||||
"MMMKXXKXXXNNXNMMMMMMMMMMX0WMMMMMMMKO0KKXNWMMMMMMMMMMMXKKKKNMMMMWKXXKXXXWMKk0NMMWONWMMMMNXKKXKWMMMMMM\n",
|
||||
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n",
|
||||
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n",
|
||||
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"! jp2a play.jpg --width=100"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" \n",
|
||||
" \n",
|
||||
" \n",
|
||||
" . .. ... .... . . .... \n",
|
||||
" ...... ..................... ...... ... ............... .. .. ..... ..... \n",
|
||||
" .. . .. .... .... .. ..... . .. ... . .. ..... ..... .. \n",
|
||||
" .. . .. ......... .. ....... ...... . .... ... . .. .. .... . ... \n",
|
||||
" .. ...... ... .. .. ...... .. . ........ ........ ... ...... .. \n",
|
||||
" . .. ..... .. . ....... . . ... .. .. .. . . \n",
|
||||
" . .............. ...... .. ... . . .. ........ ..... ... ..... . \n",
|
||||
" ........... ... ........ ...... ......... .... .... ....... \n",
|
||||
" \n",
|
||||
" \n",
|
||||
" \n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"img = '''MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n",
|
||||
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n",
|
||||
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n",
|
||||
"MMMMMMWMMMMMMMMMMMMMMMMMMMMWNMMNNWMMMMNWNNMMMMMMMMMMMMMMMMWMMMMMMMMWMMMMMMMMKNNWMMMMMMMMMMMMMMMMMMMM\n",
|
||||
"MMKdWWNXMMMxNWNNWNNONNNWNNNNWokWMNNXNNNMMWNXMMMMMMMMM0NNNNXNNNNoXWWKMMMMMMMdKMMNXMMM00NXWMMM00NNNMMM\n",
|
||||
"MM0oMMMNMMM;NMMMMMM;KXWMMMMXXKcMMxkMMMNXkkXMMMMMMMMMMcMMMMXNMMW:XMMNMMMMMMOkMMMMNXXONMMMNNNkXMMMXNMM\n",
|
||||
"MMXlMMMNMMMcXMX00KXNXkxMMMWXMM00KKoOXMWNNNNNMMMMMMMMMcMMMXNxxMW:0MMNMMMMMXdMMKlMMNox0MMMMMXMMMWXWMMM\n",
|
||||
"MMNcMMMNWWN,0MMXXNMMM0xMMMXWMMMMMMMKK00oWMMWNMMMMMMMMcMMMWWXWNXx0MMWWWWNXoWMMKcKMMNXKxxKMMMMMNNMMMMM\n",
|
||||
"MMMlMMMMMMM,0MMWWWNNM0kMMMXMMMMMMWdNNNNXMMMMXMMMMMMMMcMMMMXXNMMkkMMMMMMMcXMMMMMMMMMNNMMcMMMMMNMMMMMM\n",
|
||||
"MMMcMMWWWXN:kNXXXXXWMKd0KWXMMMMMMoOMMMMMMWNXMMMMMMMMMcMMMMXMMMMOxMWWWNXNlKMMNXXcXMNNNMMcNWWWMNMMMMMM\n",
|
||||
"MMMKXXKXXXNNXNMMMMMMMMMMX0WMMMMMMMKO0KKXNWMMMMMMMMMMMXKKKKNMMMMWKXXKXXXWMKk0NMMWONWMMMMNXKKXKWMMMMMM\n",
|
||||
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n",
|
||||
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n",
|
||||
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM'''\n",
|
||||
"\n",
|
||||
"for line in img.split(\"\\n\"):\n",
|
||||
" for letter in line:\n",
|
||||
" if letter == \"M\":\n",
|
||||
" img = img.replace(letter, \" \")\n",
|
||||
" else:\n",
|
||||
" img = img.replace(letter, \".\")\n",
|
||||
" \n",
|
||||
"print(img)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## World Wheel but different\n",
|
||||
"\n",
|
||||
"![](https://literacystarter.files.wordpress.com/2014/11/word-wheel.png)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" a a n i i i o a f i fi i \n",
|
||||
" a cm i i a \n",
|
||||
" c ti n a c ii a n n \n",
|
||||
" a f i g n a i i c \n",
|
||||
" nt i c i n c o \n",
|
||||
" a a m o m fg a cm g m \n",
|
||||
" i a i n ia a a o g i t\n",
|
||||
"nm g n i a f i i i i a i n o i if t \n",
|
||||
"o c i a i gt o g a a i i \n",
|
||||
" g o o i o f c a c a i i\n",
|
||||
" o g f i i a t c i an t a i i f n\n",
|
||||
" i i o a gm g f i \n",
|
||||
" i g f c a a ca i t c a t \n",
|
||||
" i a to a n o n o c io \n",
|
||||
" f o f iam c i i a \n",
|
||||
" g g a a m g a n a n i g \n",
|
||||
" c f o o t n o g n m t c \n",
|
||||
" f i g ng o m i i im \n",
|
||||
" a iim a i i t i i n \n",
|
||||
" c oa m a c g a n g ig i naag \n",
|
||||
" f i o a f o a a o t o g m \n",
|
||||
" t t i a i a a fa c c n \n",
|
||||
" o g m i a i i n g m m i f n i i \n",
|
||||
" n g a m i i o ft i f i f\n",
|
||||
" t m ia g i i \n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from random import choice\n",
|
||||
"\n",
|
||||
"character_set = 'gamification '\n",
|
||||
"characters = [character for character in character_set]\n",
|
||||
"width = 100\n",
|
||||
"height = 25\n",
|
||||
"\n",
|
||||
"for y in range(height):\n",
|
||||
" for x in range(width):\n",
|
||||
" print(choice(characters), end='')\n",
|
||||
" print('')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# More games plz!"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"What other mini-games can we make?\n",
|
||||
"\n",
|
||||
"You can restrict yourself to using **ASCII characters only** (see https://en.wikipedia.org/wiki/ASCII) and stay in touch with early computer graphics ASCII art...\n",
|
||||
"\n",
|
||||
"Or you can extend your pallete with **Unicode characters**. This is a nice website that highlights specific character sets: http://xahlee.info/comp/unicode_index.html"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
After Width: | Height: | Size: 22 KiB |
@ -0,0 +1,18 @@
|
||||
# Word Search Puzzle
|
||||
A simple word search made in python
|
||||
|
||||
![#demo](./demo.png)
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
$ python3 main.py -h
|
||||
usage: main.py [-h] [-c] [-f FILE]
|
||||
|
||||
Generates a word search puzzle
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-c, --cheated Hightlight words
|
||||
-f FILE, --file FILE Path to a custom words file. One word per line.
|
||||
```
|
After Width: | Height: | Size: 133 KiB |
@ -0,0 +1,50 @@
|
||||
from word_grid import *
|
||||
import argparse
|
||||
|
||||
|
||||
# Initialize parser
|
||||
parser = argparse.ArgumentParser(description="Generates a word search puzzle")
|
||||
|
||||
# Adding optional argument
|
||||
parser.add_argument("-c", "--cheated", action="store_true", help = "Hightlight words")
|
||||
parser.add_argument("-f", "--file", type=str, default="words.txt", help = "Path to a custom words file. One word per line.")
|
||||
parser.add_argument("-s", "--size", type=int, default=20, help = "Sets a custom grid size (Default: 20)")
|
||||
|
||||
# Read arguments from command line
|
||||
args = parser.parse_args()
|
||||
|
||||
def main(cheated=False, words_file=None, size=20):
|
||||
|
||||
# generating words from file
|
||||
# words = ["wear", "variable", "print", "minimum", "graduate", "room", "bulk", "advise", "completed", "memory"]
|
||||
file1 = open(words_file, 'r')
|
||||
# lines = file1.readlines() # !!! THIS LINE BLOCKED CUSTOM WORD FILES !!! -- mb
|
||||
words = [word.strip() for word in file1.readlines()] # !!! STRIP() IS ADDED !!! -- mb
|
||||
file1.close()
|
||||
|
||||
# appending words to array
|
||||
# for _ in range(10):
|
||||
# words.append(lines[random.randint(0, len(lines)-1)].strip())
|
||||
|
||||
# creating the word grid
|
||||
grid = WordGrid(size)
|
||||
|
||||
print("┌────────────────────┐")
|
||||
print("│ Word Search Puzzle │")
|
||||
print("└────────────────────┘")
|
||||
|
||||
grid.cheated = cheated
|
||||
grid.generate_with_words(words)
|
||||
|
||||
# printing the words to find
|
||||
print("Words:")
|
||||
count = 0
|
||||
for word in words:
|
||||
count += 1
|
||||
print(f"{count}. {word}", end=" | ")
|
||||
print()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(cheated=args.cheated, words_file=args.file, size=args.size)
|
||||
|
||||
# Created by Magoninho
|
@ -0,0 +1,2 @@
|
||||
hello
|
||||
worlds
|
@ -0,0 +1,6 @@
|
||||
import random
|
||||
|
||||
alphabet = 'abcdefghijklmnopqrstuvwxyz'
|
||||
|
||||
def get_random_letter():
|
||||
return alphabet[random.randint(0, len(alphabet)-1)]
|
@ -0,0 +1,50 @@
|
||||
from word_grid import *
|
||||
import argparse
|
||||
|
||||
|
||||
# Initialize parser
|
||||
parser = argparse.ArgumentParser(description="Generates a word search puzzle")
|
||||
|
||||
# Adding optional argument
|
||||
parser.add_argument("-c", "--cheated", action="store_true", help = "Hightlight words")
|
||||
parser.add_argument("-f", "--file", type=str, default="words.txt", help = "Path to a custom words file. One word per line.")
|
||||
parser.add_argument("-s", "--size", type=int, default=20, help = "Sets a custom grid size (Default: 20)")
|
||||
|
||||
# Read arguments from command line
|
||||
args = parser.parse_args()
|
||||
|
||||
def main(cheated=False, words_file=None, size=20):
|
||||
|
||||
# generating words from file
|
||||
# words = ["wear", "variable", "print", "minimum", "graduate", "room", "bulk", "advise", "completed", "memory"]
|
||||
file1 = open(words_file, 'r')
|
||||
# lines = file1.readlines() # !!! THIS LINE BLOCKED CUSTOM WORD FILES !!! -- mb
|
||||
words = [word.strip() for word in file1.readlines()] # !!! STRIP() IS ADDED !!! -- mb
|
||||
file1.close()
|
||||
|
||||
# appending words to array
|
||||
# for _ in range(10):
|
||||
# words.append(lines[random.randint(0, len(lines)-1)].strip())
|
||||
|
||||
# creating the word grid
|
||||
grid = WordGrid(size)
|
||||
|
||||
print("┌────────────────────┐")
|
||||
print("│ Word Search Puzzle │")
|
||||
print("└────────────────────┘")
|
||||
|
||||
grid.cheated = cheated
|
||||
grid.generate_with_words(words)
|
||||
|
||||
# printing the words to find
|
||||
print("Words:")
|
||||
count = 0
|
||||
for word in words:
|
||||
count += 1
|
||||
print(f"{count}. {word}", end=" | ")
|
||||
print()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(cheated=args.cheated, words_file=args.file, size=args.size)
|
||||
|
||||
# Created by Magoninho
|
@ -0,0 +1,115 @@
|
||||
from math import sqrt
|
||||
from alphabet import *
|
||||
import random
|
||||
|
||||
HORIZONTAL = 0
|
||||
VERTICAL = 1
|
||||
|
||||
class WordGrid:
|
||||
def __init__(self, width) -> None:
|
||||
self.grid = []
|
||||
self.width = width
|
||||
self.area = width**2
|
||||
self.cheated = False
|
||||
|
||||
# creating the grid array
|
||||
for col in range(self.area):
|
||||
self.grid.append(get_random_letter())
|
||||
|
||||
self.available_spots = []
|
||||
|
||||
# all the available spots that a letter can be placed
|
||||
# True: can be placed
|
||||
# False: can not be placed
|
||||
for spot in range(self.area):
|
||||
self.available_spots.append(True) # all spots are available at the beginning
|
||||
|
||||
|
||||
# generates the word grid with words
|
||||
# if this method is not called before printing the grid,
|
||||
# it will print just some random letters
|
||||
def generate_with_words(self, words):
|
||||
# check if there are too much letters
|
||||
if self.can_generate(words):
|
||||
for word in words:
|
||||
finded_place_to_enter_word = False
|
||||
while not finded_place_to_enter_word:
|
||||
|
||||
# chooses a random direction
|
||||
random_direction = random.choice([HORIZONTAL, VERTICAL])
|
||||
|
||||
# random x and y positions of the first letter of the current word
|
||||
random_x = random.randint(0, self.width-1)
|
||||
random_y = random.randint(0, self.width-1)
|
||||
|
||||
|
||||
# making sure the word won't go out of bounds
|
||||
if random_x + len(word) > self.width and random_direction == HORIZONTAL:
|
||||
random_x -= (random_x + len(word)) - self.width
|
||||
if random_y + len(word) > self.width and random_direction == VERTICAL:
|
||||
random_y -= (random_y + len(word)) - self.width
|
||||
|
||||
|
||||
# checking if the word can be placed before placing it
|
||||
if self.is_placeable(word, random_x, random_y, random_direction):
|
||||
self.place_word(word, random_x, random_y, random_direction)
|
||||
finded_place_to_enter_word = True
|
||||
|
||||
|
||||
# when generating finishes, print itself
|
||||
self.print()
|
||||
|
||||
# sets a word in a position and with a particular direction
|
||||
def place_word(self, word, x, y, direction):
|
||||
# for every letter on the word
|
||||
for l in range(len(word)):
|
||||
if direction == HORIZONTAL:
|
||||
# place horizontally
|
||||
self.grid[x+l + y * self.width] = "\033[32m" + word[l] + "\033[0m" if self.cheated else word[l]
|
||||
self.available_spots[x+l + y * self.width] = False # making the horizontal spot unavaliable
|
||||
elif direction == VERTICAL:
|
||||
# place vertically
|
||||
self.grid[x + (y+l) * self.width] = "\033[32m" + word[l] + "\033[0m" if self.cheated else word[l]
|
||||
self.available_spots[x + (y+l) * self.width] = False # making the vertical spot unavaliable
|
||||
|
||||
|
||||
# checks if a word can be placed in a position and with a particular direction
|
||||
def is_placeable(self, word, x, y, direction):
|
||||
# for every letter on the word
|
||||
for l in range(len(word)):
|
||||
spot_available = self.available_spots[x+l + y * self.width] if direction == HORIZONTAL else self.available_spots[x + (y+l) * self.width]
|
||||
|
||||
# if the spot is available, then continue checking
|
||||
if spot_available:
|
||||
continue
|
||||
# if a spot is unavaliable, then is not placeable, returns false
|
||||
else:
|
||||
return False
|
||||
# if the loop finishes without returning false, it means that is placeable, returns true
|
||||
return True
|
||||
|
||||
def can_generate(self, words):
|
||||
letter_count = 0
|
||||
for word in words:
|
||||
for letter in word:
|
||||
letter_count += 1
|
||||
# if there are much more letters than the grid area
|
||||
if letter_count > self.area:
|
||||
print("\nToo many words for a little grid!")
|
||||
return False
|
||||
if len(word) > self.width:
|
||||
print(f"\nYou entered a word too big for the grid size! (Grid size: {self.width})")
|
||||
return False
|
||||
return True
|
||||
|
||||
# prints the grid on the terminal
|
||||
def print(self):
|
||||
|
||||
print("\033[96m┌" + ("─"*(2*(self.width)+1)) + "┐\033[0m" ) # just a nice little line
|
||||
for y in range(self.width):
|
||||
print("\033[96m│\033[0m", end=" ")
|
||||
for x in range(self.width):
|
||||
print(self.grid[x + y * self.width], end=" ")
|
||||
print("\033[96m│\033[0m")
|
||||
print("\033[96m└" + ("─"*(2*(self.width)+1)) + "┘\033[0m" )
|
||||
|
@ -0,0 +1,2 @@
|
||||
hello
|
||||
worlds
|
@ -0,0 +1,108 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Generating word search puzzles"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"![](https://mario.wiki.gallery/images/thumb/3/31/WordSearch_178_1.png/683px-WordSearch_178_1.png)\n",
|
||||
"\n",
|
||||
"https://github.com/Magoninho/word-search-puzzle-generator.git"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"! git clone https://github.com/Magoninho/word-search-puzzle-generator.git"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**NOTE**: two small changes need to be made in main.py to make this code work.\n",
|
||||
"\n",
|
||||
"Comment this line out: \n",
|
||||
"\n",
|
||||
"`# words = [\"wear\", \"variable\", \"print\", \"minimum\", \"graduate\", \"room\", \"bulk\", \"advise\", \"completed\", \"memory\"]`\n",
|
||||
"\n",
|
||||
"And change this line...\n",
|
||||
"\n",
|
||||
"`lines = file1.readlines()`\n",
|
||||
"\n",
|
||||
"into: \n",
|
||||
"\n",
|
||||
"`words = [word.strip() for word in file1.readlines()]`\n",
|
||||
"\n",
|
||||
"Now it should work!"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"! python3 word-search-puzzle-generator/src/main.py -h"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"! python3 word-search-puzzle-generator/src/main.py --file word-search.txt -s 20 -c"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
hello
|
||||
world
|
||||
and
|
||||
what
|
||||
other
|
||||
words
|
||||
can
|
||||
i
|
||||
play
|
||||
with
|
@ -0,0 +1,69 @@
|
||||
a o it m i i m f c
|
||||
c i ag n o amf f o i
|
||||
o i o f i a g af i g
|
||||
m i f a t g c f t i
|
||||
n o f a f tnf o f
|
||||
a i i i i i t in c caa
|
||||
t fa n f i t a i o
|
||||
o i ag ig g g a i i i n ag
|
||||
n m gt a i o f i o ni i i
|
||||
m i f i a a a o i m a g c
|
||||
f am a c o i f cna f mi
|
||||
t a i c f g f n i c o o g
|
||||
o f t a g ng i a i a n n o a t oi i it
|
||||
o t n o m f g a i a m ni
|
||||
f i i g m o i a n t a i a a m i a i a
|
||||
i a a ac i a t i tn t a
|
||||
o f tf i an i n o f i t t
|
||||
c g fg i o o ca i o o o m t
|
||||
f o i i i c i ta i ca c f
|
||||
c n aa g i m g m i c
|
||||
c i c i f i n m f i i
|
||||
a o i g m o ot a i a c f m i
|
||||
i a a i f f a c g i
|
||||
to in a t og im i o i f n c
|
||||
ao m g ii c n a to t
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c a of g m g i a c n m a i c m i g
|
||||
fm f oi i c t g g f a c c i i n
|
||||
i i mf a in n m n
|
||||
o a i o t g o m ag
|
||||
m o o t c m c i i
|
||||
i f gii a f ic m oc m f
|
||||
m c m i t a i m go i
|
||||
n mn m a n i a i i
|
||||
i i i c i g
|
||||
iii c i a a i a o ai t i c a
|
||||
a c m i o o an f t m i a a g
|
||||
g g a c f a n c m a m f o m c i
|
||||
a g a a i n g a n
|
||||
ani a t m c n f i o g a t
|
||||
i f in i n m g ita o i a o i mc a
|
||||
in i i f ci a i to tf i ct i
|
||||
i a t o ga i t n t
|
||||
a a ii o mt fi n g f a t n a i
|
||||
g f in t ig a o i a g m ma o
|
||||
o o o g a o ni n i in f i
|
||||
i i a a n i f
|
||||
a i o i g a f a ta c a o g a i
|
||||
t tc a f i n g t i fg no
|
||||
f ot i a a a i i i g n t i t m c i n
|
||||
ic a n a i i i mi ni m a t i
|