<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1610754041418656619</id><updated>2011-12-02T18:17:56.174-08:00</updated><category term='c#'/><category term='c# wp7 xna'/><category term='rras'/><category term='wp7'/><category term='programming'/><category term='development'/><category term='windows'/><category term='.net'/><category term='vpn'/><category term='xna'/><category term='Windows Live Mesh install uninstall errors'/><category term='windows mobile'/><category term='LINQ to SQL'/><category term='asp.net mvc'/><title type='text'>Andreas Brekken</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://andreas-brekken.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://andreas-brekken.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Author of How I</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_wV2kSaB7vCk/SNTNQ1BBQzI/AAAAAAAAAAk/5Nmauw9-bsE/S220/Opuno.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1610754041418656619.post-2501497566106702387</id><published>2011-03-10T17:26:00.000-08:00</published><updated>2011-03-10T17:26:47.259-08:00</updated><title type='text'>Level math update</title><content type='html'>&lt;p&gt;The generation of levels now works. It will take a lot of testing to see if it's good enough.&lt;/p&gt;&lt;br /&gt;
&lt;img src="http://i.imgur.com/lvW8C.png" /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Levels are now created like this (pseudo):&lt;p&gt;&lt;p&gt;&lt;pre class="brush: csharp"&gt;while (!level.IsSolved)
{
  var move = Solver.GetMove(level);

  if (move == null)
  {
    if (!GenerateRandomHintGroup())
    {
      // If a hint group cannot be generated, then the level cannot be generated.
      return null;
    }
  }
  else
  {
    ApplyMove(level, move);
  }
}

return level;&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;The solver&lt;/h2&gt;&lt;p&gt;The solver currently has these "techniques" of finding moves:&lt;/p&gt;&lt;ul&gt;  &lt;li&gt;&lt;b&gt;AggregateEliminationSolver&lt;/b&gt;: Calculates every number combination that will create the sum/product/difference/etc. and eliminate any numbers that are not used in any of the solutions.&lt;br /&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;b&gt;NumberEliminatedEverywhereElseSolver&lt;/b&gt;: A number has been eliminated in every other square in its column/row and is therefore the answer.&lt;br /&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;b&gt;NumberLocationNarrowedSolver&lt;/b&gt; An example of this is when a row contains these squares (solution outside and non-eliminated numbers in brackets):&lt;ul&gt;&lt;li&gt;1 [1, 4]&lt;/li&gt;
&lt;li&gt;2 [2, 4, 5]&lt;/li&gt;
&lt;li&gt;3 [2, 3, 4]&lt;/li&gt;
&lt;li&gt;4 [1, 4]&lt;/li&gt;
&lt;li&gt;5 [1, 2, 5]&lt;/li&gt;&lt;/ul&gt;The numbers [1, 4] must be eliminated in every cell but the first and fourth.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;OnlyOneNumberNotEliminatedSolver&lt;/b&gt;: Every number but one has been eliminated in a cell.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;EqualsSolver&lt;/b&gt;: Answers with the number indicated by an equals hint group.&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610754041418656619-2501497566106702387?l=andreas-brekken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://andreas-brekken.blogspot.com/feeds/2501497566106702387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/level-math-update.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/2501497566106702387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/2501497566106702387'/><link rel='alternate' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/level-math-update.html' title='Level math update'/><author><name>Author of How I</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_wV2kSaB7vCk/SNTNQ1BBQzI/AAAAAAAAAAk/5Nmauw9-bsE/S220/Opuno.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610754041418656619.post-4065452226427356658</id><published>2011-03-07T13:41:00.000-08:00</published><updated>2011-03-07T13:41:20.519-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wp7'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='xna'/><title type='text'>Planning the level math</title><content type='html'>&lt;p&gt;With the hint groups I've decided to start with (equals and sum), it's time to start writing the math to generate and solve levels. This is how I imagine it working, roughly:&lt;/p&gt;&lt;br /&gt;
&lt;h2&gt;Generate level&lt;/h2&gt;&lt;ul&gt;  &lt;li&gt;&lt;b&gt;(Done)&lt;/b&gt; Start with an empty board of size n * n&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;(Done)&lt;/b&gt; Fill in the numbers, like discussed before&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;(Done)&lt;/b&gt; Shuffle columns and rows around to make the board random&lt;/li&gt;
  &lt;li&gt;Create a class, Solver, that given a board will return options for the next play. If this method is implemented like you'd actually play if you were good, then it is a good indicator of how many moves it takes to complete a level. This number can also be used as an indicator for the difficulty of the level.&lt;/li&gt;
  &lt;li&gt;Add hint groups to the level until the Solver is able to solve it in less than X moves.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;h2&gt;Solver&lt;/h2&gt;&lt;p&gt;The Solver class will have one method:&lt;/p&gt;&lt;pre class="brush: csharp"&gt;public static List&amp;lt;PlayAction&amp;gt; GetPossibleMoves(Level level, int? maxMoves)&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Outline of the solver code&lt;/h3&gt;&lt;p&gt;I'm not entirely sure how this will work yet. Based on how I'd play, it will do this:&lt;/p&gt;&lt;ul&gt;  &lt;li&gt;Remove answers to cells that are wrong&lt;br /&gt;&lt;br /&gt;
    This one might be optional. There can be an option in the game of whether or not it will tell you that an answer is wrong (blink red or something).&lt;br /&gt;
  &lt;/li&gt;
  &lt;li&gt;Look for equals hint groups and check off the numbers.&lt;br /&gt;
  &lt;/li&gt;
  &lt;li&gt;Eliminate numbers that cannot exist in a sum:&lt;br /&gt;&lt;br /&gt;
    Calculate all the ways to make a certain sum and exclude the numbers that cannot be used to make the sum. (I wrote the code for this when I woke up today and it works quite well)&lt;br /&gt;
  &lt;/li&gt;
  &lt;li&gt;Answer squares where every number but one is eliminated&lt;/li&gt;
  &lt;li&gt;Answer squares when it is the only one that can have a certain number&lt;/li&gt;
  &lt;li&gt;Exclude numbers when they must be used somewhere else.&lt;br /&gt;If two cells in the row have excluded every number but A and B, then A nor B can be used anywhere else in the row. This logic works for all numbers, not only two. I'm not sure how to write this yet.&lt;/li&gt;
  &lt;li&gt;Unnamed&lt;br /&gt;&lt;br /&gt;
    When a hint group has a bend/turn in it, such as:&lt;br /&gt;&lt;br /&gt;
    &lt;img src="http://i.imgur.com/n1PmK.png" alt="" title="Hosted by imgur.com" /&gt;&lt;/br&gt;&lt;br /&gt;
    The green group is a sum group that must add up to 6. There are three ways to accomplish that: (2, 2, 2), (3, 2, 1), (4, 1, 1). The solution (2, 2, 2) is impossible, because the number 2 would end up being used twice in the same column or row. Assuming the solution (3, 2, 1) is eliminated, the solution (4, 1, 1), or in the image (1, 4, 1) is given by the constraint of not repeating the number 1 in the same column or row.&lt;br /&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610754041418656619-4065452226427356658?l=andreas-brekken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://andreas-brekken.blogspot.com/feeds/4065452226427356658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/planning-level-math.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/4065452226427356658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/4065452226427356658'/><link rel='alternate' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/planning-level-math.html' title='Planning the level math'/><author><name>Author of How I</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_wV2kSaB7vCk/SNTNQ1BBQzI/AAAAAAAAAAk/5Nmauw9-bsE/S220/Opuno.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610754041418656619.post-273220430569543879</id><published>2011-03-04T18:01:00.000-08:00</published><updated>2011-03-04T18:01:15.131-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='wp7'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='xna'/><title type='text'>Registering the tap gesture</title><content type='html'>&lt;p&gt;(See &lt;a href="http://steel.codeplex.com/SourceControl/changeset/changes/5431"&gt;related changeset on CodePlex&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Registering the tap gesture wasn't as bad as I thought. In the process, I &lt;a href="http://steel.codeplex.com/SourceControl/changeset/view/5431#92365"&gt;changed the GameplayEntity class&lt;/a&gt; so that it has the additional properties and methods:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;ChildEntities&lt;/b&gt;: A list of child GameplayEntitiy objects. For now, only the PuzzleGrid contains children, which are the PuzzleSquare objects.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;ClientRect&lt;/b&gt;: Instead of having X, Y, Width, Height implemented in every GameplayEntity, this property is a Rectangle. This was done mostly to simplify hit-testing, but also makes the code cleaner overall.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;AcceptsInput&lt;/b&gt; (boolean): This property is used to exclude GameplayEntity objects from being asked for hit-testing. It doesn't seem very necessary, though.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;HandleTap&lt;/b&gt;(int x, int y): This public method is called by parents to see if any of its children can accept the input. If none of the children can, then the object itself is queried.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;OnTap&lt;/b&gt;(int clientX, int clientY): Called when a tap has been accepted. Coordinates local to the entity are used for simplicity.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;p&gt;The PuzzleSquare class overrides OnTap like this:&lt;/p&gt;&lt;pre class="brush:csharp"&gt;protected override bool OnTap(int clientX, int clientY)
        {
            Debug.WriteLine(string.Format("Square ({0}, {1}) tapped at client ({2}, {3}).", this.GridX, this.GridY, clientX, clientY));

            return false;
        }&lt;/pre&gt;&lt;br /&gt;
&lt;p&gt;&lt;img src="http://i.imgur.com/7Aqg0.png" alt="" title="Hosted by imgur.com" /&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Next up, I'll make those taps select the squares (change background color). After that, I'll get started on the HUD buttons. I should probably make a generic button class for that.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610754041418656619-273220430569543879?l=andreas-brekken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://andreas-brekken.blogspot.com/feeds/273220430569543879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/registering-tap-gesture.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/273220430569543879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/273220430569543879'/><link rel='alternate' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/registering-tap-gesture.html' title='Registering the tap gesture'/><author><name>Author of How I</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_wV2kSaB7vCk/SNTNQ1BBQzI/AAAAAAAAAAk/5Nmauw9-bsE/S220/Opuno.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610754041418656619.post-6504017003099254900</id><published>2011-03-04T16:26:00.000-08:00</published><updated>2011-03-04T16:48:39.241-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='wp7'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='xna'/><title type='text'>Puzzle squares and level generation</title><content type='html'>&lt;p&gt;(See &lt;a href="http://steel.codeplex.com/SourceControl/changeset/changes/5428"&gt;related changeset&lt;/a&gt; on CodePlex)&lt;/p&gt;

&lt;h2&gt;Puzzle level generation&lt;/h2&gt;
&lt;p&gt;The objective of the puzzle is to solve a Soduko like grid:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;The grid always has the same number of columns as rows.&lt;/li&gt;&lt;li&gt;Each row must contain the numbers 1..n, where n is the size of the puzzle.&lt;/li&gt;&lt;li&gt;Each column must contain the numbers 1..n, where n is the size of the puzzle.&lt;/li&gt;&lt;li&gt;Each number may only occur once in each column.&lt;/li&gt;&lt;li&gt;Each number may only occur once in each row.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
The level generator works, after &lt;a href="http://stackoverflow.com/questions/5175329/struggling-to-make-algorithm-to-generate-board-for-a-puzzle-game/"&gt;advice from Stack Overflow&lt;/a&gt;, by generating a grid in the following form:
&lt;/p&gt;&lt;p&gt;&lt;img src="http://i.imgur.com/CSjNq.png"&gt;&lt;/p&gt;&lt;p&gt;Basically, the value in each cell (for any value of &lt;i&gt;x&lt;/i&gt; in &lt;i&gt;0..n-1&lt;/i&gt; and any value of &lt;i&gt;y&lt;/i&gt; in &lt;i&gt;0..n-1&lt;/i&gt;) is &lt;i&gt;(x + y) % size + 1&lt;/i&gt;

&lt;p&gt;To generate random level (&lt;a href="http://steel.codeplex.com/SourceControl/changeset/view/5428#92415"&gt;source code&lt;/a&gt;), rows are swapped randomly and then columns are swapped randomly. As it was &lt;a href="http://stackoverflow.com/questions/5175329/struggling-to-make-algorithm-to-generate-board-for-a-puzzle-game/"&gt;mentioned on Stack Overflow&lt;/a&gt;, this will generate 216 different puzzles on a 5x5 board. Although there are other combinations, I will let the column and row swapping method be for now, because the implementation is easy.&lt;/p&gt;

&lt;h2&gt;Puzzle square drawing&lt;/h2&gt;
&lt;p&gt;
The next step was to make the &lt;a href="http://steel.codeplex.com/SourceControl/changeset/view/5428#92414"&gt;PuzzleSquare class&lt;/a&gt;. For now, it's a copy of the other GameEntity objects.&lt;/p&gt;
&lt;p&gt;Below is a picture of a 7x7 grid and a 10x10. I doubt anything more than 8-ish will be playable on a phone. There are some imperfections in the margin/padding/width calculations that I'll look at later.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://i.imgur.com/C32Aj.png" alt="" title="Hosted by imgur.com" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://i.imgur.com/LJBHi.png" alt="" title="Hosted by imgur.com" /&gt;&lt;/p&gt;

&lt;p&gt;Next, the user must be able to click on square in the puzzle grid and then guess which number it is using buttons in the hud (right). I have never worked with user input in XNA, so that will be a challenge.&lt;/p&gt;

&lt;p&gt;After that, I'll write the "hint groups". For example, the game will tell you that the number in (0, 0) equals 7 and that the sum of (0, 0) and (1, 0) is 10. In other words, you know that (1, 0) is 3, because 7+3=10. I haven't decided how to display hint groups yet.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610754041418656619-6504017003099254900?l=andreas-brekken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://andreas-brekken.blogspot.com/feeds/6504017003099254900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/puzzle-squares-and-level-generation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/6504017003099254900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/6504017003099254900'/><link rel='alternate' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/puzzle-squares-and-level-generation.html' title='Puzzle squares and level generation'/><author><name>Author of How I</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_wV2kSaB7vCk/SNTNQ1BBQzI/AAAAAAAAAAk/5Nmauw9-bsE/S220/Opuno.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610754041418656619.post-758984573352629441</id><published>2011-03-04T15:45:00.000-08:00</published><updated>2011-03-04T15:56:29.070-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wp7'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='xna'/><title type='text'>Puzzle grid and hud drawing</title><content type='html'>&lt;p&gt;(See related &lt;a href="http://steel.codeplex.com/SourceControl/changeset/changes/5426"&gt;changeset on CodePlex&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;I've started on the &lt;a href="http://steel.codeplex.com/SourceControl/changeset/view/5426#92250"&gt;GameplayGameScreen class&lt;/a&gt;. It now has two properties that will be important:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Hud (of type &lt;a href="http://steel.codeplex.com/SourceControl/changeset/view/5426#92411"&gt;Hud&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;PuzzleGrid (of type &lt;a href="http://steel.codeplex.com/SourceControl/changeset/view/5426#92251"&gt;PuzzleGrid&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;
The GameplayGameScreen class initializes, updates, and draws the Hud and PuzzleGrid:
&lt;/p&gt;
&lt;p&gt;&lt;img src="http://i.imgur.com/2ywvv.png" title="Puzzle grid and HUD" /&gt;&lt;/p&gt;
&lt;p&gt;Because resizing at some point can become a nightmare with too many constants, I made a little spreadsheet and &lt;a href="http://steel.codeplex.com/SourceControl/changeset/view/5426#92250"&gt;coded in&lt;/a&gt; (ResizeEntities method) some dynamic resizing:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://i.imgur.com/DwZzB.png"&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610754041418656619-758984573352629441?l=andreas-brekken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://andreas-brekken.blogspot.com/feeds/758984573352629441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/puzzle-grid-and-hud-drawing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/758984573352629441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/758984573352629441'/><link rel='alternate' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/puzzle-grid-and-hud-drawing.html' title='Puzzle grid and hud drawing'/><author><name>Author of How I</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_wV2kSaB7vCk/SNTNQ1BBQzI/AAAAAAAAAAk/5Nmauw9-bsE/S220/Opuno.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610754041418656619.post-3160080569182197035</id><published>2011-03-04T14:45:00.000-08:00</published><updated>2011-03-04T14:46:45.750-08:00</updated><title type='text'>Source code for Steel</title><content type='html'>I'll be uploading the source code as I progress to &lt;a href="http://steel.codeplex.com/"&gt;Steel on CodePlex&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610754041418656619-3160080569182197035?l=andreas-brekken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://andreas-brekken.blogspot.com/feeds/3160080569182197035/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/source-code-for-steel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/3160080569182197035'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/3160080569182197035'/><link rel='alternate' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/source-code-for-steel.html' title='Source code for Steel'/><author><name>Author of How I</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_wV2kSaB7vCk/SNTNQ1BBQzI/AAAAAAAAAAk/5Nmauw9-bsE/S220/Opuno.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610754041418656619.post-2086638690132024673</id><published>2011-03-04T14:07:00.000-08:00</published><updated>2011-03-04T14:45:08.205-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c# wp7 xna'/><title type='text'>Starry night background</title><content type='html'>&lt;p&gt;Here's what the background looks like. It scrolls from right to left:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://i.imgur.com/52UV9.png" title="Starry night background" /&gt;&lt;p&gt;
&lt;p&gt;If you want to use this yourself: &lt;a href="http://msdn.microsoft.com/en-us/library/bb203868.aspx"&gt;Making a Scrolling Background&lt;/a&gt; on MSDN.&lt;/p&gt;
&lt;h2&gt;Code&lt;/h2&gt;
&lt;p&gt;You can download the CS-files from MSDN and the implementation of their background class is very short: &lt;a href="http://steel.codeplex.com/SourceControl/changeset/view/5423#92236"&gt;BackgroundGameScreen.cs&lt;/a&gt; (CodePlex)&lt;/p&gt;

&lt;p&gt;Notice how I now use a shared SpriteBatch. Because GameScreen inherits from &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.drawablegamecomponent.aspx"&gt;DrawableGameComponent&lt;/a&gt;, it has a property allowing access to the Game-object.&lt;/p&gt;

&lt;p&gt;Next, I'll start working on the GameplayScreen.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610754041418656619-2086638690132024673?l=andreas-brekken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://andreas-brekken.blogspot.com/feeds/2086638690132024673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/starry-night-background.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/2086638690132024673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/2086638690132024673'/><link rel='alternate' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/starry-night-background.html' title='Starry night background'/><author><name>Author of How I</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_wV2kSaB7vCk/SNTNQ1BBQzI/AAAAAAAAAAk/5Nmauw9-bsE/S220/Opuno.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610754041418656619.post-5903625993478058475</id><published>2011-03-04T13:47:00.000-08:00</published><updated>2011-03-04T14:01:01.238-08:00</updated><title type='text'>XNA game design for Windows Phone 7</title><content type='html'>&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;I just downloaded the XNA SDK to try making a game for Windows Phone 7.&lt;/p&gt;

&lt;p&gt;Although there are many lab games that have reusable logic, I found it hard to understand some of the design decisions. For the time being, I'll be doing everything from the ground up and rather letting myself be inspired by the labs and other people's example code online.&lt;/p&gt;

&lt;h2&gt;Game screens&lt;/h2&gt;
&lt;p&gt;This will be a puzzle game, like a Sudoku. I'll need the following game screens:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Background (this one will always be drawn, but never not accepting input)&lt;/li&gt;
&lt;li&gt;Gameplay screen (active when playing, accepts input)&lt;/li&gt;
&lt;li&gt;Menu screen (accepts input)&lt;/li&gt;
&lt;li&gt;Pause screen (popup over gameplay screen that can accept input)&lt;/li&gt;
&lt;li&gt;Other popups, like highscore displays&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Development plan&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;(In progress)&lt;/b&gt; Write basic screen management system&lt;br/&gt;
There are plenty of labs and other tutorials online with ways to do this. The idea of the screen manager is to maintain a stack of screens, for example: Background, Gameplay, Pause screen. Each screen has properties like IsPopup, CanAcceptsInput, Visible, IsCoveredByPopup and these properties are used to make sure objects are drawn in order and screens only update when it is required.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;(Completed)&lt;/b&gt; Animating background&lt;br/&gt;It may seem a bit odd that I started with this already. I found a &lt;a href="http://msdn.microsoft.com/en-us/library/bb203868.aspx"&gt;scrolling starry night background&lt;/a&gt; on MSDN that works well with minimal implementation efforts.&lt;br/&gt;With an animating background I will, from the beginning, know that the game is not getting stuck and that resources are being loaded correctly (an asset is used for the starry night background)&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610754041418656619-5903625993478058475?l=andreas-brekken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://andreas-brekken.blogspot.com/feeds/5903625993478058475/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/xna-game-design-for-windows-phone-7.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/5903625993478058475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/5903625993478058475'/><link rel='alternate' type='text/html' href='http://andreas-brekken.blogspot.com/2011/03/xna-game-design-for-windows-phone-7.html' title='XNA game design for Windows Phone 7'/><author><name>Author of How I</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_wV2kSaB7vCk/SNTNQ1BBQzI/AAAAAAAAAAk/5Nmauw9-bsE/S220/Opuno.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610754041418656619.post-5371484559629044844</id><published>2010-08-28T07:53:00.001-07:00</published><updated>2011-03-04T13:37:15.306-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LINQ to SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Method 'System.TimeSpan Subtract(System.DateTime)' has no supported translation to SQL.</title><content type='html'>&lt;p&gt;You are writing this:&lt;/p&gt;
&lt;pre class="brush: csharp:"&gt;from a in context.People
from b in context.People
where a.BirthDate.Subtract(b.BirthDate).TotalDays &lt; 1
select new { a, b };&lt;/pre&gt;
&lt;p&gt;You receive the error:&lt;/p&gt;
&lt;pre&gt;Method 'System.TimeSpan Subtract(System.DateTime)' has no supported translation to SQL.&lt;/pre&gt;
&lt;p&gt;You should be writing this:&lt;/p&gt;
&lt;pre class="brush: csharp"&gt;from a in context.People
from b in context.People
where (a.BirthDate - b.BirthDate).TotalDays &lt; 1
select new { a, b };&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610754041418656619-5371484559629044844?l=andreas-brekken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://andreas-brekken.blogspot.com/feeds/5371484559629044844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://andreas-brekken.blogspot.com/2010/08/method-systemtimespan.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/5371484559629044844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/5371484559629044844'/><link rel='alternate' type='text/html' href='http://andreas-brekken.blogspot.com/2010/08/method-systemtimespan.html' title='Method &apos;System.TimeSpan Subtract(System.DateTime)&apos; has no supported translation to SQL.'/><author><name>Author of How I</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_wV2kSaB7vCk/SNTNQ1BBQzI/AAAAAAAAAAk/5Nmauw9-bsE/S220/Opuno.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610754041418656619.post-7611701443972081247</id><published>2010-08-12T03:49:00.000-07:00</published><updated>2010-08-12T03:58:38.799-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='rras'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='vpn'/><title type='text'>.NET: Progammatic manipulation of Windows VPN</title><content type='html'>After hours of searching I finally found a solution to manipulate, including connecting to, Windows RRAS (including VPN) connections in .NET: &lt;a href="http://dotras.codeplex.com/" title="DotRas"&gt;DotRas&lt;/a&gt;.

If you need code examples aside from the ones supplied in the release download and the ones in the help file, there are some console programs in certain changesets on its CodePlex.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610754041418656619-7611701443972081247?l=andreas-brekken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://andreas-brekken.blogspot.com/feeds/7611701443972081247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://andreas-brekken.blogspot.com/2010/08/net-progammatic-manipulation-of-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/7611701443972081247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/7611701443972081247'/><link rel='alternate' type='text/html' href='http://andreas-brekken.blogspot.com/2010/08/net-progammatic-manipulation-of-windows.html' title='.NET: Progammatic manipulation of Windows VPN'/><author><name>Author of How I</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_wV2kSaB7vCk/SNTNQ1BBQzI/AAAAAAAAAAk/5Nmauw9-bsE/S220/Opuno.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610754041418656619.post-2910944719301097664</id><published>2009-04-06T09:17:00.000-07:00</published><updated>2009-04-06T09:21:05.416-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Live Mesh install uninstall errors'/><title type='text'>Windows Live Mesh: class not registered</title><content type='html'>Make sure that the "Windows Firewall" service is running.

1) Start -&gt; Run -&gt; net start "windows firewall"

or

2) Start -&gt; Run -&gt; services.msc&lt;ENTER&gt;, locate "Windows Firewall" service and press Start.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610754041418656619-2910944719301097664?l=andreas-brekken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://andreas-brekken.blogspot.com/feeds/2910944719301097664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://andreas-brekken.blogspot.com/2009/04/windows-live-mesh-class-not-registered.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/2910944719301097664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/2910944719301097664'/><link rel='alternate' type='text/html' href='http://andreas-brekken.blogspot.com/2009/04/windows-live-mesh-class-not-registered.html' title='Windows Live Mesh: class not registered'/><author><name>Author of How I</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_wV2kSaB7vCk/SNTNQ1BBQzI/AAAAAAAAAAk/5Nmauw9-bsE/S220/Opuno.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610754041418656619.post-5095214190829386884</id><published>2009-02-22T20:52:00.001-08:00</published><updated>2011-03-04T13:45:50.711-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net mvc'/><title type='text'>Integrating blogger.com with a personal website</title><content type='html'>&lt;p&gt;My website, andreasbrekken.com, runs ASP.NET MVC and is highly integrated with popular services such as Flickr, Delicious, and Blogger.&lt;/p&gt;&lt;p&gt;So how do you display posts?&lt;/p&gt;&lt;span style="font-weight:bold;"&gt;In your controller:&lt;/span&gt;
&lt;pre class="brush:csharp"&gt;this.ViewData["Blog"] = from x in XDocument.Load("http://andreas-brekken.blogspot.com/feeds/posts/default")
                         .Root.Elements(XName.Get("entry", "http://www.w3.org/2005/Atom")).Take(10)
                     select x;
&lt;/pre&gt;&lt;span style="font-weight:bold;"&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;
&lt;/span&gt;&lt;/div&gt;In your view:&lt;/span&gt;
&lt;pre class="brush:csharp"&gt;    &amp;lt;ul class="blog-entries"&amp;gt;  
        &amp;lt;li&amp;gt;
         &amp;lt;h3&amp;gt;&amp;lt;%= x.Element(XName.Get("title", "http://www.w3.org/2005/Atom")).Value%&amp;gt;&amp;lt;/h3&amp;gt;
         &amp;lt;%= x.Element(XName.Get("content", "http://www.w3.org/2005/Atom")).Value %&amp;gt;
         &amp;lt;a class="more-link" href="&amp;lt;%= x.Elements(XName.Get("link", "http://www.w3.org/2005/Atom"))
             .First(y =&gt; y.Attribute("rel").Value == "alternate").Attribute("href").Value %&amp;gt;"&amp;gt;Read the entry&amp;lt;/a&amp;gt;
         &amp;lt;/li&amp;gt;
     &amp;lt;% } %&amp;gt;
 &amp;lt;/ul&amp;gt;
&lt;/pre&gt;&lt;p&gt;It'd be a better idea to process all of the XML in the controller and then pass the posts as strongly typed, or anonymous class, objects.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610754041418656619-5095214190829386884?l=andreas-brekken.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://andreas-brekken.blogspot.com/feeds/5095214190829386884/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://andreas-brekken.blogspot.com/2009/02/first-post-test.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/5095214190829386884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610754041418656619/posts/default/5095214190829386884'/><link rel='alternate' type='text/html' href='http://andreas-brekken.blogspot.com/2009/02/first-post-test.html' title='Integrating blogger.com with a personal website'/><author><name>Author of How I</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_wV2kSaB7vCk/SNTNQ1BBQzI/AAAAAAAAAAk/5Nmauw9-bsE/S220/Opuno.gif'/></author><thr:total>0</thr:total></entry></feed>
