Try something like this. (Keeping with the BASIC theme) 10 CLS 20 W = 10 30 H = 10 40 RANDOMIZE TIMER 50 FOR I = 1 TO W: PRINT " __"; : NEXT I 60 PRINT "" 70 FOR I = 1 TO H 80 PRINT "| "; 90 FOR J = 1 TO W - 1 100 IF INT(RND(1) * 2) = 0 THEN PRINT " __"; ELSE PRINT "| "; 110 NEXT J 120 PRINT "|" 130 NEXT I 140 PRINT "|"; 150 FOR I = 1 TO W - 1: PRINT "__ "; : NEXT I 160 PRINT "__|"
Lines 20 and 30 specify the width and height of the maze Lines 50 and 60 draw the north outer wall of the maze Lines 70 - 130 draw the maze by randomly drawing either a west or south wall. Line 80 draws the first cell in a row, which won't have a south wall, to make a long empty hall Line 120 draws the east-most outer wall at the end of each row Lines 140 - 160 draw the last row, just a long empty hall.
You'll see that the maze has no loops or isolations. Every cell is reachable from every other cell by a single path.
A binary tree maze algorithm will generate a "perfect maze" (no loops, isolations, and only a single path between any two cells), though you need a long hallway along two sides (depending on which edges you use for walls).
Mazes with square cells share edges, so by assuming some rules about the outside walls of a maze, you can represent each cell in a maze with only two bits. You need only store, for example, just the south and west walls of each cell.
To make a binary tree maze, first assume an outer wall and a long hall (no south walls) in the first column, and along the bottom row (no west walls). For all remaining cells, randomly add a west or south wall. You don't need any information about adjacent cells -- just flip a coin and draw a wall for each remaining cell. This will produce a "perfect maze". It's pretty cool.
The code I posed will generate a binary tree maze, though it won't show the two long halls. (In this case, the program uses west and south walls, so the halls will be the in the first column and the along the bottom row.)
The lameness filter doesn't want me to show you an example. Still, it's pretty easy to make a nice binary tree maze generator yourself. Give it a try and you'll see how it works.
For fun, you can make four binary tree mazes and arrange them so that you have two long halls (one East to West, the other North to South) intersecting at the center of the maze, just by choosing which pair of walls to randomly generate in each quadrant. It makes a much more interesting looking maze without adding much complexity (just figure out which quadrant the current cell is in) and retaining all of the properties of a perfect maze.
In fact, because it's random, you'd be blocked off at some point.
Nonsense. See: Binary tree mazes.
Also, I recommend that you look at other maze generation algorithms (especially Eller's Algorithm) as you can easily create a random yet solvable maze where there is exactly one path between any two cells -- no loops or isolations. In the case of Eller's Algorithm, you can create a random maze of any length that has this property without keeping the entire maze in memory -- just a single line!
Indeed, it isn't exactly rocket science -- zillions of kids under 10 picked up the basics of BASIC from type-in programs in kids books and magazines back in the 80's.
What bugs me most is that instead of doing the obvious (making a binary tree maze) it's some weird artifact of how the / and \ combine on-screen that makes something that vaguely resembles a maze -- full of loops (no big deal) large winding sections without any junctions (bad), and isolations (terrible!).
Just for fun:
IBM PC users! You can modify the C64 program in the summary to both run on your micro and produce a binary tree maze with this simple change: PRINT CHR$(220 + INT(RND(1)*2) );
You won't be able to get the same effect with alternating forward- and back-slashes with something like PRINT CHR$(47 + INT(RND(1)*2)*45); as they don't connect at all -- neither on the same line nor between lines.
Really? This nonsense again? It's like you're purposefully ignoring long-established facts.
RIM can't give the keys away for BES users because they don't have them. BlackBerry customers continue enjoy true mobile message security -- unlike users on every other business and consumer platform.
As always, if you care about security, RIM is your ONLY option. No one else even comes close.
By "moving away from RIM" I assume you mean "considering including alternatives in addition to RIM". "Announced intent" is different from "switched over".
Why I doubt it'll actually happen: Despite announcing that they were seeking this three years ago, iOS STILL lacks FIPS certification (FIPS-140-2 is a pipe dream for iOS at this point. BB10 isn't even out yet and it's already been certified).
So we'll see how this works out for iOS. It doesn't look like they can get their products certified for use in government departments. Maybe they gave up trying?
The other thing is that addressing our stance on energy usage is inherently more efficient. Either we use less fuel to do the same sorts of things, or we use different, cheaper, cleaner fuels to do the same things. Instead of relying 100% on fossil fuels, solar energy (for instance) provides a long-term source of electricity that is thermodynamically effectively free (i.e., it would've been absorbed and/or re-radiated as waste heat anyway--this breaks down in places where the albedo is high and would have reflected the light, but it's still going to be better than fossil fuels, on balance).
More forests, cleaner air, more captured carbon. Healthier oceans? More food, clean water, less need to purify our own waste out of it. More jobs. Fewer starving people. (As opposed to overfishing, which is a short-term win, but a long-term loss when fish populations come down to a level that is impossible to monetize.)
These are all things we should be doing anyway. The climate change issue is just a distraction.
Most of what we lack isn't technological, it's political.
If the issue is political, why drag a politically controversial (that is essentially irrelevant) along? Why not argue for these things on their own merits?
Do you know how much money would fall in their laps if they actually *could* prove it isn't happening? Coal and oil money would make them rich beyond imagination.
This doesn't make any sense. None.
Are you some kind of conspiracy nut?
What, so they prove that AGW isn't true and then... what? They get free coal mines and oil wells? Energy companies in those sectors would hand them bags of money because... they're really grateful?
It's like the Slashdot version of WND . The same brand of crazy, just a different flavor.
So you're saying you're inclined to disregard all claims of danger without examining the reasons behind them?
Well, yes. I'd rather not get in line behind Henny Penny, Cocky Locky, and Goosey Loosey hoping to strike up a conversation with Turkey Lurkey to find out how it is that we came to the conclusion that the sky is falling, while running towards the 'safety' Foxy Loxy's lair.
The news cycle has nothing but one alarmist story after another proclaiming the end of life as we know it. It doesn't make any sense to take the time to evaluate every warning of impending doom. It's nonsense most of the time. ("Most of the time" feels a bit like the worlds biggest understatement, as does "With the extremely rare exception") Well, you get the point.
Give me evidence first, then convince me to panic. Not the other way around.
Tell 'em brother -- they're too stupid to understand the science, so they can't even have an opinion that differs from the majority of climate scientists!
Elbow from the sky: Any climate scientist that holds a different position is obviously being paid off by big pollution -- so, really, 100% of all climate scientists are in agreement.
Knock-out blow: You're not a climate scientist? Shut it. You don't know shit! Listen to what the authorities tell you. Get in line!
There is literally no long-term downside to improving our approach to the environment.
Improving the environment is a fine idea. But let's not pretend that we can say with any degree of certainty that there are no long term down-sides. For all we know, any action we take to affect the climate may result in a worse outcome than inaction.
All the down-sides are short term.
I guess that depends on your perspective, doesn't it? What does "short term" mean to you? 10 years, 100 years, 1000 years? What do you see as the downsides?
Even the economic benefits in the long run (or at least, the lack of economic penalties) are enormous.
Now you're really far out in the land of wild speculation. For some reason, I'm starting to think that you haven't put any thought in to this...
You know what, I think you're one of the crazy people that think that the anti-AGW folks are actively out to hurt the environment like the bad-guys on Captain Planet. Those people don't exist.
It's not to distort the numbers, it's to give developers realistic expectations. If you're not a major player, this is what you should expect. If you happen to own Angry Birds, great. Everyone else, on the other hand, is scrambling for the scraps. (80% of iOS developers are competing for the last 3% of revenue in the game market, for example.)
Hate on RIM all you want, but smart developers know where the money is.
I'm afraid the BB platform has changed far too late to attract any developers
You haven't been paying attention. Developers are flocking to the platform. RIM's outreach efforts (combined with an incredible suite of tools) have been wildly successful. There have been a few high-profile games studios that have praised RIM's new platform and tools. One example Galaxy on Fire 2 HD was ported to the PlayBook by a single engineer in one day. The web is loaded with examples like this. It's a great platform for developers, both financially and technically, and developers that have taken a few minutes to consider the platform have decided that it's exactly where they want to be.
Try something like this. (Keeping with the BASIC theme)
10 CLS
20 W = 10
30 H = 10
40 RANDOMIZE TIMER
50 FOR I = 1 TO W: PRINT " __"; : NEXT I
60 PRINT ""
70 FOR I = 1 TO H
80 PRINT "| ";
90 FOR J = 1 TO W - 1
100 IF INT(RND(1) * 2) = 0 THEN PRINT " __"; ELSE PRINT "| ";
110 NEXT J
120 PRINT "|"
130 NEXT I
140 PRINT "|";
150 FOR I = 1 TO W - 1: PRINT "__ "; : NEXT I
160 PRINT "__|"
Lines 20 and 30 specify the width and height of the maze
Lines 50 and 60 draw the north outer wall of the maze
Lines 70 - 130 draw the maze by randomly drawing either a west or south wall.
Line 80 draws the first cell in a row, which won't have a south wall, to make a long empty hall
Line 120 draws the east-most outer wall at the end of each row
Lines 140 - 160 draw the last row, just a long empty hall.
You'll see that the maze has no loops or isolations. Every cell is reachable from every other cell by a single path.
Hope that helps. Happy maze making!
A binary tree maze algorithm will generate a "perfect maze" (no loops, isolations, and only a single path between any two cells), though you need a long hallway along two sides (depending on which edges you use for walls).
Mazes with square cells share edges, so by assuming some rules about the outside walls of a maze, you can represent each cell in a maze with only two bits. You need only store, for example, just the south and west walls of each cell.
To make a binary tree maze, first assume an outer wall and a long hall (no south walls) in the first column, and along the bottom row (no west walls). For all remaining cells, randomly add a west or south wall. You don't need any information about adjacent cells -- just flip a coin and draw a wall for each remaining cell. This will produce a "perfect maze". It's pretty cool.
The code I posed will generate a binary tree maze, though it won't show the two long halls. (In this case, the program uses west and south walls, so the halls will be the in the first column and the along the bottom row.)
The lameness filter doesn't want me to show you an example. Still, it's pretty easy to make a nice binary tree maze generator yourself. Give it a try and you'll see how it works.
For fun, you can make four binary tree mazes and arrange them so that you have two long halls (one East to West, the other North to South) intersecting at the center of the maze, just by choosing which pair of walls to randomly generate in each quadrant. It makes a much more interesting looking maze without adding much complexity (just figure out which quadrant the current cell is in) and retaining all of the properties of a perfect maze.
I hope that helps.
Here you go:
http://peter.sorotokin.com/maze/Maze.html
It's just below the java applet.
Plagiarizer. You stole this from reddit -- from the same post linked from Nick Montfort's blog.
Enterprise Java Version:
http://www.reddit.com/r/programming/comments/142jix/10_print_chr_2055_rnd_1_goto_10_how_a_single_line/c79elxn
You shouldn't take credit for the work of others. That +5 funny is a filthy dirty lie.
In fact, because it's random, you'd be blocked off at some point.
Nonsense. See: Binary tree mazes.
Also, I recommend that you look at other maze generation algorithms (especially Eller's Algorithm) as you can easily create a random yet solvable maze where there is exactly one path between any two cells -- no loops or isolations. In the case of Eller's Algorithm, you can create a random maze of any length that has this property without keeping the entire maze in memory -- just a single line!
Indeed, it isn't exactly rocket science -- zillions of kids under 10 picked up the basics of BASIC from type-in programs in kids books and magazines back in the 80's.
What bugs me most is that instead of doing the obvious (making a binary tree maze) it's some weird artifact of how the / and \ combine on-screen that makes something that vaguely resembles a maze -- full of loops (no big deal) large winding sections without any junctions (bad), and isolations (terrible!).
Just for fun:
IBM PC users! You can modify the C64 program in the summary to both run on your micro and produce a binary tree maze with this simple change: PRINT CHR$(220 + INT(RND(1)*2) );
You won't be able to get the same effect with alternating forward- and back-slashes with something like PRINT CHR$(47 + INT(RND(1)*2)*45); as they don't connect at all -- neither on the same line nor between lines.
Most?
+5 Funny!
No, RIM offers the most comprehensive set of MDM features of any smartphone or MDM product vendor.
Really? This nonsense again? It's like you're purposefully ignoring long-established facts.
RIM can't give the keys away for BES users because they don't have them. BlackBerry customers continue enjoy true mobile message security -- unlike users on every other business and consumer platform.
As always, if you care about security, RIM is your ONLY option. No one else even comes close.
By "moving away from RIM" I assume you mean "considering including alternatives in addition to RIM". "Announced intent" is different from "switched over".
Why I doubt it'll actually happen: Despite announcing that they were seeking this three years ago, iOS STILL lacks FIPS certification (FIPS-140-2 is a pipe dream for iOS at this point. BB10 isn't even out yet and it's already been certified).
So we'll see how this works out for iOS. It doesn't look like they can get their products certified for use in government departments. Maybe they gave up trying?
Not really. Your little play-pretend scenarios are ridiculously implausible.
Of course, you can't see it because you've already bought in to a bunch of wild conspiracy theories.
It's the exact same brand of crazy you'll find on sites like WND.
You should try reality some time. It's pretty amazing, if a bit less dramatic.
The other thing is that addressing our stance on energy usage is inherently more efficient. Either we use less fuel to do the same sorts of things, or we use different, cheaper, cleaner fuels to do the same things. Instead of relying 100% on fossil fuels, solar energy (for instance) provides a long-term source of electricity that is thermodynamically effectively free (i.e., it would've been absorbed and/or re-radiated as waste heat anyway--this breaks down in places where the albedo is high and would have reflected the light, but it's still going to be better than fossil fuels, on balance).
More forests, cleaner air, more captured carbon. Healthier oceans? More food, clean water, less need to purify our own waste out of it. More jobs. Fewer starving people. (As opposed to overfishing, which is a short-term win, but a long-term loss when fish populations come down to a level that is impossible to monetize.)
These are all things we should be doing anyway. The climate change issue is just a distraction.
Most of what we lack isn't technological, it's political.
If the issue is political, why drag a politically controversial (that is essentially irrelevant) along? Why not argue for these things on their own merits?
I made no such claim.
rich beyond imagination
Paid speaking engagements, a right-wing book deal, and a token job will make you "rich beyond imagination", eh?
You must have a shit imagination.
Do you know how much money would fall in their laps if they actually *could* prove it isn't happening? Coal and oil money would make them rich beyond imagination.
This doesn't make any sense. None.
Are you some kind of conspiracy nut?
What, so they prove that AGW isn't true and then ... what? They get free coal mines and oil wells? Energy companies in those sectors would hand them bags of money because ... they're really grateful?
It's like the Slashdot version of WND . The same brand of crazy, just a different flavor.
So you're saying you're inclined to disregard all claims of danger without examining the reasons behind them?
Well, yes. I'd rather not get in line behind Henny Penny, Cocky Locky, and Goosey Loosey hoping to strike up a conversation with Turkey Lurkey to find out how it is that we came to the conclusion that the sky is falling, while running towards the 'safety' Foxy Loxy's lair.
The news cycle has nothing but one alarmist story after another proclaiming the end of life as we know it. It doesn't make any sense to take the time to evaluate every warning of impending doom. It's nonsense most of the time. ("Most of the time" feels a bit like the worlds biggest understatement, as does "With the extremely rare exception") Well, you get the point.
Give me evidence first, then convince me to panic. Not the other way around.
You don't need evidence if you have the laws of physics and chemistry on your side.
Read that over and over until you understand what's wrong with it.
Go ahead, I'll wait.
Yeah! Argument from authority beat down!
Tell 'em brother -- they're too stupid to understand the science, so they can't even have an opinion that differs from the majority of climate scientists!
Elbow from the sky: Any climate scientist that holds a different position is obviously being paid off by big pollution -- so, really, 100% of all climate scientists are in agreement.
Knock-out blow: You're not a climate scientist? Shut it. You don't know shit! Listen to what the authorities tell you. Get in line!
Anit-AGW punks just got told.
There is literally no long-term downside to improving our approach to the environment.
Improving the environment is a fine idea. But let's not pretend that we can say with any degree of certainty that there are no long term down-sides. For all we know, any action we take to affect the climate may result in a worse outcome than inaction.
All the down-sides are short term.
I guess that depends on your perspective, doesn't it? What does "short term" mean to you? 10 years, 100 years, 1000 years? What do you see as the downsides?
Even the economic benefits in the long run (or at least, the lack of economic penalties) are enormous.
Now you're really far out in the land of wild speculation. For some reason, I'm starting to think that you haven't put any thought in to this...
You know what, I think you're one of the crazy people that think that the anti-AGW folks are actively out to hurt the environment like the bad-guys on Captain Planet. Those people don't exist.
Wait, are you really putting actual data over the word of an unnamed anonymous source on some guys blog?
What is the world coming to!
The article is rampant speculation on an unconfirmed rumor from some a blog site that references a "trusted source".
I think we all know (thanks to sites like BGR) exactly how those rumors usually pan out.
I suspect that the data came directly from Paul Thurrott's dirty place.
Unless you think every bald guy you've ever met is a lying, thieving, two faced, rapist.
Now that you mention it...
It doesn't work that way. Maybe you should read the terms of the 10k developer commitment?
Oh, would knowledge and facts ruin your talking point? Sorry, that's not my fault.
It's not to distort the numbers, it's to give developers realistic expectations. If you're not a major player, this is what you should expect. If you happen to own Angry Birds, great. Everyone else, on the other hand, is scrambling for the scraps. (80% of iOS developers are competing for the last 3% of revenue in the game market, for example.)
Fun fact: 13% of developers on the BlackBerry platform earn more than 100k/year from their apps
Hate on RIM all you want, but smart developers know where the money is.
I'm afraid the BB platform has changed far too late to attract any developers
You haven't been paying attention. Developers are flocking to the platform. RIM's outreach efforts (combined with an incredible suite of tools) have been wildly successful. There have been a few high-profile games studios that have praised RIM's new platform and tools. One example Galaxy on Fire 2 HD was ported to the PlayBook by a single engineer in one day. The web is loaded with examples like this. It's a great platform for developers, both financially and technically, and developers that have taken a few minutes to consider the platform have decided that it's exactly where they want to be.
Working link:
BlackBerry apps earn the most money. Get over it.
Also, it's REALLY a stretch to call the 10k developer commitment "paying people to develop" apps for BB10.