I think that for this situation you can just represent your maze as a matrix of boolean values. The boolean values can be used to indicate whether there is a wall for that position. Here's an example (with true indicating that the right side doesn't have a wall): __ __ __ __ |__ |__ | [[true, false, true, false] | | | | [false, false, true, false], | | __| | => [false, true, false, false], | | __| [true, false, true, false], |__|__|__ __| [false, false, true, false]] The top, bottom, and left sides implicitly have a wall. Using this representation, you should be able to calculate your end point in a time proportional to the distance between an end and start point. The ball only needs to know its `(x, y)` position. Your walls likely don't have to be their own class for this problem. If you ever want to extend your program such that landing on specific types of walls (say a fire wall) results in different behavior, then objects may be helpful. Even in that case, I would say that using an `enum` may be sufficient.