Open Side Menu Go to the Top

07-06-2011 , 03:01 PM
lols A*
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
07-06-2011 , 03:50 PM


my friend's entry for brogramming

(C# in the background, not PHP)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-06-2011 , 06:30 PM
Brogramming... I don't hit a gym, but I do use a lot of cURL in PHP. I wonder if that counts.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-07-2011 , 04:27 AM
This is a funny one from brogramming

** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-07-2011 , 08:29 AM
Great. I woke up to find my Drobo had an extra 800 GB on it and was full. ****ing Time Machine...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-08-2011 , 03:40 AM
Just Started working on my first Mac app. Was having a play around with Interface Builder last night... not sure its my favourite GUI builder.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-08-2011 , 08:11 AM
Actually wiring stuff up was pretty good mind bender when all my experience had been with one of MS's Visual Studio languages.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-08-2011 , 08:41 AM
Ye, still not got to grips with all the dragging between buttons and actions. Still not really sure what an outlet is.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-08-2011 , 08:47 AM
An outlet is an instance variable pointer that can be initialized with an object in IB.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-08-2011 , 09:14 AM
Quote:
Originally Posted by kerowo
Great. I woke up to find my Drobo had an extra 800 GB on it and was full. ****ing Time Machine...
On further inspection I lost a drive so I take back what I said about Time Machine...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-08-2011 , 11:02 AM
Quote:
Originally Posted by Neil S
An outlet is an instance variable pointer that can be initialized with an object in IB.
Finally managed to find the apple documentation on outlets. Makes more sense now.

Thx
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2011 , 03:13 PM
I have a quick algorithm question.. I'm trying to parse and reformat a text file that has a bunch of level descriptions for a board type game that has a format like:

Code:
 ## #####
## ## . #
# ## $. #
 ## $   #
## $@ ###
# $  ##
#.. ## ##
#   # ##
##### #
I want to replace all of the spaces not contained by the pound signs (which represent wall tiles) with underscores. The best I can think is loop over the level four times, coming from each direction until I hit a wall and replacing spaces to that point with underscores. That leaves me with results like:

Code:
_##_#####
##x## . #
#x## $. #
_## $   #
## $@ ###
# $  ##__
#.. ##x##
#   #_##_
#####_#__
I'm not sure how to hit the cases where an outside space is hidden in this approach (marked with x's), I'd appreciate any tips. And while efficiency isn't a huge concern as this is a one-time operation on loading a new level file, I feel like there should be a simpler method to handle this than the one I'm already using.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2011 , 03:22 PM
maybe i don't understand the problem but it seems to me that all the Xs are in spaces which are, in fact, contained by #s, so it looks like your bottom diagram is already correct.

edit: as for algorithm:

foreach space accessible from the outside {
mark space with underscore
calculate accessible neighbors of that space and repeat
}

?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2011 , 03:24 PM
i dont understand the problem. what is a space not contained by a pound sign?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2011 , 03:29 PM
Quote:
Originally Posted by tyler_cracker
maybe i don't understand the problem but it seems to me that all the Xs are in spaces which are, in fact, contained by #s, so it looks like your bottom diagram is already correct.
Ack. You're right I gave a bad example.

Code:
     #####
     #   #
     #   #        ######
   ###  ## #####  #    ###
   #    #        ## #$$  #
  ##$   ########## $  $  #
###  ## ..........$  #$$@#
#    # $$# ####### $     #
#   $  #...#     ###  ####
#   #   $ ### ##   ####
########    #
       #    #
       #    #
       ######
to

Code:
_____#####________________
_____#   #________________
_____#   #________######__
___###  ##_#####__#    ###
___#    #x_xxxxx_## #$$  #
__##$   ########## $  $  #
###  ## ..........$  #$$@#
#    # $$# ####### $     #
#   $  #...#x_xx_###  ####
#   #   $ ###_##___####___
########    #_____________
_______#    #_____________
_______#    #_____________
_______######_____________
The first case I gave is probably something I won't worry about, that would take an additional heuristic to determine if the walls its contained in are walls around the level proper or not, which complicates it way too much.

Quote:
i dont understand the problem. what is a space not contained by a pound sign?
The places I marked with a x. The remaining spaces are supposed to be empty floor tiles inside a walled level. The underscores are supposed to be empty space.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2011 , 03:36 PM
I have never done anything like this. But, I was reading the PDF docs for Zend last week (side note: I ****ing hate generating PDFs), and came across these two methods that can be used for determining if a point is contained in a boundary.

Quote:
The nonzero winding number rule determines whether a given point is inside a path by conceptually drawing a ray from that point to infinity in any direction and then examining the places where a segment of the path crosses the ray. Starting with a count of 0, the rule adds 1 each time a path segment crosses the ray from left to right and subtracts 1 each time a segment crosses from right to left. After counting all the crossings, if the result is 0 then the point is outside the path; otherwise it is inside. Note: The method just described does not specify what to do if a path segment coincides with or is tangent to the chosen ray. Since the direction of the ray is arbitrary, the rule simply chooses a ray that does not encounter such problem intersections. For simple convex paths, the nonzero winding number rule defines the inside and outside as one would intuitively expect. The more interesting cases are those involving complex or self-intersecting paths like the ones shown in Figure 4.10 (in a PDF Reference). For a path consisting of a five-pointed star, drawn with five connected straight line segments intersecting each other, the rule considers the inside to be the entire area enclosed by the star, including the pentagon in the center. For a path composed of two concentric circles, the areas enclosed by both circles are considered to be inside, provided that both are drawn in the same direction. If the circles are drawn in opposite directions, only the "doughnut" shape between them is inside, according to the rule; the "doughnut hole" is outside.
and

Quote:
An alternative to the nonzero winding number rule is the even-odd rule. This rule determines the "insideness" of a point by drawing a ray from that point in any direction and simply counting the number of path segments that cross the ray, regardless of direction. If this number is odd, the point is inside; if even, the point is outside. This yields the same results as the nonzero winding number rule for paths with simple shapes, but produces different results for more complex shapes. Figure 4.11 (in a PDF Reference) shows the effects of applying the even-odd rule to complex paths. For the five-pointed star, the rule considers the triangular points to be inside the path, but not the pentagon in the center. For the two concentric circles, only the "doughnut" shape between the two circles is considered inside, regardless of the directions in which the circles are drawn.
I don't know if that helps at all, but it might give you a starting point, anyway.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2011 , 04:00 PM
Quote:
Originally Posted by Zurvan
I don't know if that helps at all, but it might give you a starting point, anyway.
If I understand this right, it won't work, at least the even-odd rule - not sure I understand the first. Here's a picture of the level in question with what I think this approach is saying:



The red lines are the even spaces, the blue odd, and the algorithm says that the blue or odd spaces are inside the boundary. Think these approaches only work with polygon shapes where every "boundary" is part of the sides of the polygon, where in my case I have internal boundaries that aren't on the sides (the wall between 1 and 2 here).
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2011 , 04:04 PM
Code:
###  ####
##     #
###   #
#######
so eg, here nothing is enclosed?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2011 , 04:08 PM
if this is the case, i would consider an algorithm that starts with possible exit points (ez to find those), and then finds "neighbor who is a space" for each exit point, adding them to a list in generations. eventually, the list stops growing and you know you are done and have found every possible non-enclosed space. All other spaces are enclosed. Not sure how efficient this is compared to optimal algo, but it would be super simple to write and would work.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2011 , 04:11 PM
Looks like if a vertical line hits a pound sign it's an underscore otherwise not. Throw it into an array and start checking x-1 until you hit an underscore, pound, or boundary. Looks like if you hit an underscore you can stop looking.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2011 , 09:00 PM
Quote:
Originally Posted by jukofyork
This seems like it might be a good solution but I'm having some trouble understanding how to implement it after looking at the pseudo-code implementation on the wiki page. I assume in my case there would be no background value, and each character in the level definition would be analogous to a unique pixel value in the wiki example - or would the background value be applied to every non-space character? Any chance you could try explaining it in my context?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2011 , 09:33 PM
Quote:
Originally Posted by weevil
This seems like it might be a good solution but I'm having some trouble understanding how to implement it after looking at the pseudo-code implementation on the wiki page. I assume in my case there would be no background value, and each character in the level definition would be analogous to a unique pixel value in the wiki example - or would the background value be applied to every non-space character? Any chance you could try explaining it in my context?
The pound signs (which are showing up as hashes, '#', for me though?) would be the background.

After you've run the algorithm you'll have a set of labelled regions. The only thing left to do is go round the border of the image and find out which (if any) of the labelled regions touch the border... You can then partition your regions into two: ones that touch the border and ones that don't (ie: the ones you want to replace with '_' symbols and the ones you don't respectively).

An alternative method would be to temporarily add a 1 pixel border round your image (of empty squares / space symbols) and then run a flood fill algorithm starting at one of the added pixels like (0,0) (see here: http://en.wikipedia.org/wiki/Flood_fill).

Juk
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2011 , 09:43 PM
Quote:
Originally Posted by jukofyork
The pound signs (which are showing up as hashes, '#', for me though?)
Lol I think that's just these wacky foreigners with their crazy names for things

For reference, a real Pound sign looks like this: £
(# / hash, occasionally shorthand for ye olde imperial unit "Lbs".)

Last edited by _dave_; 07-10-2011 at 09:50 PM. Reason: :doh: levelled imo. or is this a re-level?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2011 , 09:44 PM
Quote:
Originally Posted by jukofyork
The pound signs (which are showing up as hashes, '#', for me though?) would be the background.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m