Skip to content

This repository is meant to accompany the power of paths post on the schulich ignite blog

License

Notifications You must be signed in to change notification settings

Descent098/power-of-paths

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Power of paths

This repository is meant to accompany the power of paths post on the schulich ignite blog. Essentially it's here to show off different path encodings. The repo is implemented in python and spread across the different encoding techniques discussed.

If you are unfamiliar with any of the below it's recommended to look into them before looking at the code:

Table of contents

Cell-based encoding

Cell based encoding is useful for applications where your data is easily structured. Lots of game systems (chess, battleship, minesweeper etc.), physics calculations & graphs (Cartesian coordinates), and even spreadsheets (A1 or R1C1 Notation).

In our case we have implemented 3 systems to show off how cell-based encoding works.

Chess

chess.py: An implementation of a chess board and pieces using standard chess notation. So in this case the white king ( or K) would be at E8, so ♔E8 or KE8 would be valid:

Spreasheets

spreadsheet.py: Is an implementation of a standard spreadsheet system (like excel), which gives you access to create cells and assign them to set columns and rows.

Tic-tac-toe

tic-tac-toe.py:Tic-tac-toe is a game where you have two players (X and O), a player wins when 3 of their characters form a line. We can represent each move by using a letter for the column and a number for a row. So in the image below we can say X's moves were A1 B2 C3

Delimiters

Delimiters are an incredibly useful encoding for paths. They are used in situations that have containers and items. Items are basically just whatever resource you are looking for (files, location in a map app etc.), containers are something that can contain other containers and/or items (folders, cities in a map app etc.). When we write a path we will specify the container that contains the items and delimit (seperate) them with some sort of indicator.

As an example we have a virtual filesystem created at filesystem.py:

We can then say the path to lake.png would be C://project/images/lake.png.

Lookups

Lookups are used to give each item in your search space a unique ID, from this you can directly find a resource. A great example of this is dictionaries in python. There are tons of ways to use lookups, but the example in lookup-users.py is using lookups to locate a specific user based on their email!

LR Format

In the article we defined a custom LR encoding for mazes. Essentially you include an L or an R for each turn of a maze until completion:

Maze with solution string

Maze after solution string is used to solve maze

The python file just stores the data in a maze object and can be found at maze.py

Combination

To show how these systems might interact I have created shipping-system.py, which uses lookups, delimiters and cells!

About

This repository is meant to accompany the power of paths post on the schulich ignite blog

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages