RSS

Tag Archives: walkthrough

A Question about Kindle

Has anyone out there been publishing on Kindle? I wanted to format my children’s book, Sheriff Harry, for publishing with Amazon, but I’m afraid I’m inept at formatting for this platform.

With iBooks Author, there is a simple WYSIWYG interface, so it was simple to drop images and text in. However, Every time I try to make a kindle document, all I get is the HTML code showing through.

I’ve looked around and tried following other’s advice, but so far haven’t been able to make it work. Any help would be greatly appreciated (suggestions, templates, websites with good walkthroughs).

Thanks very much in advance.

-Jack

 
Leave a comment

Posted by on January 9, 2013 in Uncategorized

 

Tags: , , , , , , ,

Adding the Methods

Step5: Adding methods to interpret actual suit and value of cards

 

//Hand Constructor

var Hand = function(){

    this.card1 = deal();

   

    console.log(“card1 is “+this.card1.number+” of ” + this.card1.suit);

    this.card2 = deal();

    console.log(“card2 is “+this.card2.number+” of ” + this.card2.suit);

   

};

 

//Card Constructor

var Card = function(s,n){

    this.number = n;

    this.suit = s;

 

 

            this.getSuit = function(s){

     //console.log(“I’m here in getSuit”);

     switch(this.suit){

        case 1:

            this.suit = “clubs”;

            break;

        case 2:

            this.suit = “diamonds”;

            break;

        case 3:

            this.suit = “hearts”;

            break;

        case 4:

            this.suit = “spades”;

            break;

     }

            };

 

            this.getValue = function(n){

     console.log(“I’m here in getValue”);

     if (n === 1){

         this.value = 11;

     }

    else if (n >= 11){

        this.value = 10;

    }

     else{

         this.value = n;

     }

            };

};

 

 

//Deal function

var deal = function(){

            var suit = Math.floor(Math.random()*4)+1;

            console.log(“deal function suit: “+suit);

var number = Math.floor(Math.random()*13)+1;

            console.log(“deal function number: “+number);

            return new Card(suit,number);

};

 

//Main Function

var myHand = new Hand();

myHand.card1.getSuit(myHand.card1.suit);

myHand.card1.getValue(myHand.card1.number);

console.log(“card1 is a “+myHand.card1.suit+” of value “+myHand.card1.value);

myHand.card2.getSuit(myHand.card2.suit);

myHand.card2.getValue(myHand.card2.number);

console.log(“card2 is a “+myHand.card2.suit+ ” of value “+myHand.card2.value);

 

 

In this section I added two methods (these are just functions that handle objects). Methods are placed inside of the objects they work on (is this right?Always?). In this program my methods interpret the suit and number variables as the suit that the number represents (clubs, diamonds, etc) and the value of the card (ace = 11, face cards are all worth 10 and numbered cards are worth their numerical value).

As usual, I have included a couple console.log statements so that I could track where problems cropped up along the way.

 

 

Tags: , , , , , ,

Next steps… making the card objects

Step4: Adding the Card Class (called from Deal function)

 

//Hand Constructor

var Hand = function(){

this.card1 = deal();

console.log(“card1 is “+this.card1.number+” of “ + this.card1.suit);

this.card2 = deal();

console.log(“card2 is “+this.card2.number+” of “ + this.card2.suit);

};

 

//Card Constructor

function Card(s,n){

            this.number = n;

this.suit = s;

 

 

            getSuit (method to interpret suit numbers)

 

            getValue(method to interpret value unbers)

 

}

 

//Deal function

var deal = function(){

            var suit = Math.floor(Math.random()*4)+1;

            console.log(“deal function suit: “+suit);

var number = Math.floor(Math.random()*13)+1;

            console.log(“deal function number: “+number);

            return new Card(suit,number);

};

 

//Main Function

var myHand = new Hand();

 

 

New text is highlighted in red(Although I’m not sure this formatting will follow through to the post). Here we are adding a function call at the end of the ‘deal’ function in the form of a ‘return’ statement. This means that the deal function will generate two random numbers for us and then send these to the ‘card’ constructor to make our new card objects.

I’m leaving most of the card object unfinished at this point. We will come back later to add methods for interpreting the information associated with each card object.

 

 
 

Tags: , , , ,

function#1: User provides number of digits in the secret code

Here’s my first function.

It prompts the user to provide a number of digits from 1-6. It then confirms this with the user – well, really just me for debugging purposes. I also use a Boolean ‘codeVeritas’ to ensure that the number of digits the user enters is within the parameters defined.

 

//gets the number of digits used
var code = function(){
    var enteredCode = 0;
    var codeVeritas = false;
    //so far the codeVeritas is working fine
    while (codeVeritas === false){
        console.log(“***code function reached***”);
        enteredCode = prompt(“How many digits shall the code be? (1-6)”);
        //verify input
        if (enteredCode > 0 && enteredCode <= 6){
            console.log(“We will be using “+ enteredCode+ ” digits in our code”);
            codeVeritas = true;
            return enteredCode;    
        } else{
            alert(“number is out of range.”);
            
        }
    }

};

 

Tags: , , , , , , ,

MasterMind

A quick outline on what we need to do to get a simple app:

1. The hard part (make the app itself – I’ve already posted an outline of the way this might be coded, I’ll certainly spend a lot more time fleshing this out here as we go)

2. Setting up space with apple to publish this app

a. Come up with a good name (I’m thinking of something like ‘codeBreaker’ or safeCracker) and reserve that on iTunes Connect (the developer side of iTunes)

b. Describe the app, put together a prototype with artwork to make screenshots and Icons required in iTunes Connect and certainly required to make the app itself.

Presently, I’ve chosen the name SafeCracker! and made up a quick mock of an icon in powerpoint (shown). You have to have an icon and at least one screenshot to reserve the name with, but you can change these as you go along the process. As I said, I made an icon that will have to be refined and for now, I’m using a screenshot from another app to placehold. You need to add some other details as well in the registration form, but most of those are simply things you can make up on the spot. For instance, I use the 6 digit date as my SKU number.Image

 
Leave a comment

Posted by on June 27, 2012 in Uncategorized

 

Tags: , , , ,