Apr
14
Posted on 14-04-2009
Filed Under (Programming Hints, School Work) by Steven on 14-04-2009

So today I passed off my chess project in my Computer Science CS 240 class.  I think I finished in a fairly good amount of time.  Only stayed up late one night working on it.  My code isn’t super effective in all aspects, although I did manage to do a few things that helped me simplify things.

  • I used an external XML parser called CMarkup, it is free for non-commercial use and it handles all of the silly cases the TA’s give us just fine (just remember to xml.ResetMainPos(); after parsing the board so it can still parse the history even if it came before the board in the xml file.
  • I only wrote two GetCandidateMoves functions.  One for my Piece class and one for the Pawn class.  I just defined directions for each piece, and the main piece move method just got squares in each direction until piece was found or it went off the board.  The pawn class was special just because it had special cases for the first move and capturing moves
  • I wrote a couple of methods in my main Game class that checked for Check and Checkmate (which also shared some child methods).  Stalemate was simply when it is Checkmate but not Check (with the way I wrote those methods).
  • I had memory issues until I took all pointers out of the MoveHistory.  I ended up just saving the piece type and color in the move history instead of a pointer to the piece.  I had issues leaking memory since sometimes I was putting pointers from the pieces saved in the Board class in the MoveHistory then other times I was putting pointers from the Board class in the MoveHistory.  So, so pointers in the move history.  And I made the board basically be the holder for all of the active piece pointers.  When a piece was captured or created, that is when I called delete or new. ( And the board destructor would clean-up any pieces left on the board when exiting or deleting the board before loading a new file).

Another project done for Steven Hansen, and now I am done with a CS minor and a EE major.

    (2) Comments    Read More   
    Apr
    08
    Posted on 08-04-2009
    Filed Under (School Work) by Steven on 08-04-2009

    We are doing a chess program so I had to make another super long design document. Chess Design Document And here is an html link to one small part of our EcEN 490 senior project final report. All pretty boring documents that I posted here just to save them online somewhere.

    (0) Comments    Read More   
    Mar
    18
    Posted on 18-03-2009
    Filed Under (Programming Hints, School Work) by Steven on 18-03-2009

    For a large project in my Computer Science class at BYU (cs240), I needed to implement a simple webcrawler, that would create a database of words, each page that contains each word, and a database of all of the pages that were crawled (whether they had parsed words on them or not). It was a pretty large project, with the added complexity that many of the standard library tools like or other c++ standard library datatypes where not allowed. We had to implement our own BST and linkedlist. Any way it is now done. And you can get a full .xml document that it includes an index of all of the words on my blog (before this post). Ok, the xml document isn’t really that interesting. It’s just the only output to show for my hours of work for this school project.

    (0) Comments    Read More   
    Feb
    20
    Posted on 20-02-2009
    Filed Under (School Work) by Steven on 20-02-2009

    Boring and un-interesting, here is a link to the 41 page design document for my webcrawler project in CS 240 at BYU. None of the method bodies have been implemented so this document is pretty much worthless.

    (0) Comments    Read More   
    Jan
    20
    Posted on 20-01-2009
    Filed Under (School Work) by Steven on 20-01-2009

    Known helpful files that can be run on the cs machines for cs 240 at byu.

    ~cs240ta/bin/robotest
    ~cs240ta/bin/sort240test

    Also, a * star in my notes, final exam question here

    Read the rest of this entry »

    (0) Comments    Read More