Front Page Posts

Page: 1 2 3 4 5 ... 19 20 21

How to Programmatically Draw a Polygon

Posted by Blake on 11 Vigeo 11:1
For some reason you find yourself needing to draw a polygon on a pixel surface given a set of points. Or perhaps even multiple sets of points to draw a compound polygon with gaps in it. Assume the grid is pixels. Sure, it's a pretty small polygon that will end up grainy when we're done. But smal...

Coding Interview 11: Where is the Restroom?

Posted by Blake on 11 Vigeo 11:0
Given a list of restroom locations (some struct with an x and y coordinte) return the closest restroom to a given point. Part 1: Find the closest restroom to a point Simple enough. Loop through the list of coordinates and use the distance formula. Keep track of the lowest distance you find and the...

North Avenue #34: Happy November Travel Day

Posted by Blake on 11 Vigeo 10:5
"You are special. Likie a beautiful unique snowflake. Your parents and teachers have always told you. And it doesn't stop there, either. You are special here, too. There is something uniquely wrong with your reservation in a most trivial way. Perhaps it's because the computer doesn't like the apos...

PyGame Tutorial Part 7 - Centralizing Scene Logic

Posted by Blake on 11 Vigeo 10:4
This isn't a PyGame-specific tutorial per-se. It's more of an application of good software design concepts. This model of doing things has served me well for many complicated games. If you are not familiar with Object-Oriented programming in Python, familiarize yourself now. Done? Excellent. H...

Differences Between Various SQL Joins

Posted by Blake on 11 Vigeo 10:3
In a simple SELECT query, you gather information from one table. However, this is rarely enough information for doing anything useful. If you have a table with a list of users and a table with a list of forum posts, surely you'd like to see the username next to each post. One way of doing this is se...

Problem of the Whenever #13

Posted by OmnipotentEntity on 11 Vigeo 10:2
Black to Live. Answer: I'm going to start delaying the answers until the next problem of the week. Feel free to use the discussion area to try to figure it out.

The Logic Behind a Three Piece Shuffle

Posted by Blake on 11 Vigeo 10:1
This is a tutorial on how to solve any Rubik's-style mechanical twisting puzzle. It's also one of the shortest puzzle tutorials you'll ever read. So let's jump right into it... This is called a Teraminx. But the name doesn't matter too much. It's a giant extension of the Megaminx. If you're f...

Coding Interview 10: Efficient and Scalable Sprite collision

Posted by Blake on 11 Vigeo 10:0
Consider a list of sprites. Suppose these sprites are in a game on a GIANT map. It's not a particularly crowded map, but because the map is SO huge there are thousands of sprites. Write a collision detection algorithm. Yes, I really was asked this question once in an interview for a non game devel...

PyGame Tutorial Part 6 - More on Input

Posted by Blake on 11 Vigeo 9:5
There are two basic ways to get the state of any input device. Those are checking the event queue or polling. Every time a key or button is pressed or released, or the mouse is moved, an event is added to the event queue. You must empty this event queue out each frame by either calling pygame.event....

10,000 Digits of Phi

Posted by Blake on 11 Vigeo 9:4
Otherwise known as the golden ratio = 1.6180339887 4989484820 4586834365 6381177203 0917980576 2862135448 6227052604 6281890244 9707207204 1893911374 8475408807 5386891752 1266338622 2353693179 3180060766 7263544333 8908659593 9582905638 3226613199 2829026788 0675208766 8925017116 9620703222 104321...
Page: 1 2 3 4 5 ... 19 20 21