Thursday, November 30, 2017

The last C# programming challenge I completed


Greetings everyone! Once again, just by looking at the title, you know what I will be talking about. Now I know that some of you out there aren't programmers, so I will try not to go all computer nerd, and be like, "and this line of code does this, while this makes this do that-" Also, just to be clear, when I say last challenge, I just mean the last thing the book wanted me to do. I'm still programming my own games.

So as you can see in the video, I made a game of Chess. And I have to say, the coding was complicated. Now every time the book gave me a challenge, I needed to open an activity document on my File Explorer. Usually, I'm only given one document. But for this challenge, I was given five documents. The first one wasn't so bad, until the end. I couldn't get the coding right, so I asked my Dad. Guess what we found out. The code that I was trying to put in, wasn't supposed to be put in just yet! As a matter of fact, later in time, I learned that the same code I was trying to put in, was in the wrong place. The second document was the easiest one. All I had to do, was cut and paste a file on my File Explorer. But after that is where things got hard.

One of the hardest parts, was where I had to fill in the Handle click method. The reason it was hard was because I had to tell the computer what to do in case of check, still in check, what to do if a piece is captured, and select/deselect a chess piece. The deadline to complete this challenge was Thanksgiving. I only had a few weeks to meet the deadline. So I would try to get as much coding in as possible every time I worked on it. Another hard part was the pawn. All I had to do at one point was tell it how it can move at the start, after the first move, and have it move diagonal when it captures an enemy. There are about 43 lines of code for just the pawns. Rooks and bishops have only 4, kings and queens have 9, and the knights have 17. (Yes, I counted for this post....)

Well, in the end of it all, I didn't want my Chess game to be like the others. So I decide that if you move your king, but it's still in check, the message box will say, "Nice move. However, your king is still in DANGER!" The other thing I did, was put in a beep whenever your king is still in danger, or is in check. All in all, this was a good programming course. Which I also met the deadline! But the next time I make a visual game, I'm going to copy and paste my Chess board program. :-)

2 comments:

  1. Very impressive what you have accomplished! I can’t wait to read more about your adventures!

    ReplyDelete