RSS

Tag Archives: startup

MasterMind

This weekend I spent some time online looking for some good suggestions on practicing to write code. I’m still all ears if there are any good practice exercises out there that you might recommend, but I came across someone’s practice problem of making a version of the game master mind.

I used to love this game as a kid because it felt like being a code breaker – I guess it WAS being a code breaker, but I mean that it felt like it mattered to break the code. Anyway, at first glance, I thought this would make for a good project. Something to slow me down from gobbling up codecademy – because I’m getting to the point where the lessons are not so easy and straight forward and I may need time to digest some more.

This brings me to my design. I don’t know if I have a design yet. But what’s the design going to be? I feel like it’s a super easy game and should be super easy to code, but the more I think about it, the harder it gets. I worry that I may be making it harder than it needs to be too… but that will come out when I get to the coding.

So, here’s the basic outline… what happens in a game of mastermind?

(I’m designing it so that the computer makes the code and the player tries to crack it)

1. Computer asks for two pieces of input.

a. how many places / digits will the code be?

b. how many colors (I’m actually going to use numbers) should be available?

2. Computer makes up a secret code based on that input

3. computer asks you to guess a code

4. computer checks your code for right number/right space or right number/wrong space and gives feedback

5.computer calculates how many tries you take to get a correct answer and (perhaps) keeps a leader board.

Now there also has to be some verifications put in place to make sure you choose a valid guess and that you’re not repeating yourself.

The fist hurdle I see if how does it not duplicate itself. (i.e. if position1 of a four digit secret code is ‘1’ and your guess is 1123, how to make sure that it calls position #1 as right number/right position and not give a second credit of right number/wrong position to digit2 of the guess?

I’m sure that there is some proper ordering of the if/then/else look to do that, but I’m a serious noobie and that’s exactly the kind of thing I need to learn.

When I do solve this project, I would like to take the next step and translate my Javascript mastermind into something in Xcode and use a graphic interface.It would even be nice to put this game up for DHS if I could – because I’m going to start making business rules for success here.

#1 is going to be take your job seriously.

#2 make the most of every exercise

I really do take this seriously. I know it’s a small thing, but I am trying my best to make this company work and if that means putting serious effort into making computer exercises, then so be it.

To make the most of every exercise, I am going to hold my feet to the fire and really make this game and get it through the Apple store. I could do this exercise and kind of throw away the result, but if I’m going to make the most of it, that means doing a good job, making a complete product that looks good and going through the steps with Apple, because, frankly, that’s not easy either and it’s another place that practice can pay off.

OK. program, expand the program and compile and start following some rules to keep me on track.Image

 
Leave a comment

Posted by on June 25, 2012 in Codecademy, Coding

 

Tags: , , , , , , , , ,