generating unintelligent random maps on mouse press

this code generates random maps on mouse press. it is really just a simple 2d array value filling. a modification of this article. demo explanations   def random_map():     for r in range(map_length):         for c in range(map_length):             game_map[c][r] = random.randint(0,1)   here we generated a random map by looping and assigning a random value. randint returns a value… Continue Reading generating unintelligent random maps on mouse press

game map rendering

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… Continue Reading game map rendering

polygon drawer implementation (processing.py)

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… Continue Reading polygon drawer implementation (processing.py)

home machine learning project : identifying cutlery items

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… Continue Reading home machine learning project : identifying cutlery items

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

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… Continue Reading matplotlib scatter plot annotate / set text at / label each point