## game map rendering

game map rendering or simply map rendering is a nice technique that is used to generate worlds. explanations follow suit : demo explanations   game_map = [         [0,0,0,0,0],         [0,1,0,1,0],         [0,0,1,0,0],         [0,1,0,1,0],         [0,0,1,0,0],         ]   first we initialise our world as a 2d array, we distinguished patterns by using 0 and 1   tile_width = 50   next we initialised …

## polygon drawer implementation (processing.py)

if ever you wanted to implement a polygon drawer, here it is : explanations   nodes = [     [50,40],     [40,50]   ]   first we added some coordinates as 2d arrays       for i,node in enumerate(nodes):         try:             line(nodes[i][0], nodes[i][1], nodes[i+1][0], nodes[i+1][1])         except:             pass   then for each coordinate we drew a line from it to the next, the …

## handling curly braces in string formatting – python

let us say you want to print : {text} using ‘{ {} }’.format(content) how to escape the {}? ‘\{ {} \}’.format(content) works not the answer the answer is to double curly braces like that : ‘{{ {} }}’.format(content) simple !

## home machine learning project : identifying cutlery items

machine learning is becoming crucial to add to your backpack. this post attempts to show a basic application of machine learning. we need to determine whether some cutlery items are bowls or mugs or plates. this is a practical demonstration of applied theory machine learning is just applied maths from start to finish, machine learning …

## matplotlib scatter plot annotate / set text at / label each point

a hard question in matplotlib is to annotate each point with a text or label. answers range from ax.annotate to some more weird stuffs. fortunately, the answer is a simple one! this question poses itself quite often in scatter plots the key without beating around the bush, the answer is using pyplot.text found here demo code …

## building an indentation lexer in python – a tutorial

scope by indentation is an alternative to curly braces and is used by languages like python and pug. it certainly is more human-friendly as experience gathered tends to produce more and more friendly syntaxes (like livecode). we’ll in this post build an indentation analyser that correctly tells us when we mixed indentation level; just like python …

## data usage policy

we have drafted our data usage policy and taken appropriate measures to ensure transparency. it can be found here

## building a lexer in python – a tutorial

knowing how to build a lexer allows you to extend your applications and opens up a whole new world. You can write your own DSLs or your own language or just better separate symbols: in other words, it allows you to have more control over a string what is a lexer? from user input to …

## greenBerry – a new programming language

What is greenBerry? greenBerry (shortly gb) is a brand new one-line statement programming language. It was started as a fun project and it doesn’t have much functionality or practical purposes yet, but we have an infinite look ahead for it. On the technical side it is based on Python and for now you need to …

## a fix to tkinter output not showing

tkinter is fine once you understand it. let us see what problem user vikas was having and how to fix it! the fix a basic tkinter skeleton is import tkinter as tk root = tk.Tk() root.mainloop() now we see that the user has it in place, so no output means the label he defined is not showing. now …

## processing.py : trails using oop

in this post, we’ll explain how to add trails using an oop approach. a trail is basically objects that appear where the primary objects passed in nature, trails are made by particles of the primary object but in programming, one simple approach is to draw other shapes albeit more small the full code there is the full processing.py code : # github.com/abdur-rahmaanj class MouseTrail: …

## tkinter : tackling import for python 2 and 3

tkinter is the integrated GUI package in python. It has had an import naming change in python 3. This is the main hindrance in making tkinter codes run on python 3 or vice versa. fortunately the fix is a simple one Some syntax in python 2 we imported as : import Tkinter and in python 3 …