This website stores cookies. Click here to accept them.cookie information page

1st January 1970

Add your comment for "":

Neither solution is perfect. We need to start again from scratch

Jims, 21 Nov 2011

Jims - Disagree - starting from scratch is essentially what html5 has done. Problem is that it takes time to develop, and browser usage needs to catch up to make it generally available. Anything that 'works' therefore will always be out of date and someone will be complaining that ''we need to start from scratch''.

Dave Polanski, 22 Nov 2011

Thanks for this thought provoking blog post, Marcus. With the e-commerce customer you mentioned, it was actually the sales through the online shop that went up fourfold as a result of usability changes, although traffic did go up as well.

I agree you shouldn't blog just to get rankings. The risk with that is you just churn out low grade content of little relevance to your organisation or your audiences. But by creating authentic, valuable and thought provoking content, you can over time, establish your organisation as an authority in a particular niche. And this can only encourage existing customers, members, sponsors or audiences to stay with you, or join you, or refer you.

Ned Wells, 23 Nov 2011

I feel so much happier now I understand all this. Thanks!

Aggy, 6 Dec 2011

Good points all around. Truly appreciated.

Nodin, 6 Dec 2011

I'm really into it, thanks for this great stuff!

Loryn, 6 Dec 2011

Free knowledge like this doesn't just help, it promote deomcrcay. Thank you.

Earthwind, 6 Dec 2011

This is way more helpful than anyhtnig else I've looked at.

Tiger, 6 Dec 2011

Whoa, whoa, get out the way with that good information.

Margie, 6 Dec 2011

It's wonderful to have you on our side, haha!

Lovie, 6 Dec 2011

Many many quality points there.

Ollie, 6 Dec 2011

I have been so bewildered in the past but now it all makes sense!

Carlye, 6 Dec 2011

I thought I'd have to read a book for a discovery like this!

Janet, 6 Dec 2011

My problem was a wall until I read this, then I smashed it.

Molly, 6 Dec 2011

Wow, that's a really clever way of thinking about it!

Champ, 6 Dec 2011

Thank God! Someone with brains speaks!

Heloise, 6 Dec 2011

Great thinking! That really breaks the mould!

Janess, 6 Dec 2011

Good blog post, Jon.

I personally only employ stuff that was covered earlier in the lessons. I saw some of those "look what I've done!" forum entries as well, but quickly realised that reading those would only confuse the hell out of me.

If there'll be a project or challenge which is useful to me, I might enhance it in private. Not heavily into card games here though, heh.

Drachenzauberei, 2 Feb 2012

Hey Drachenzauberei,

Yeah, I like keeping things simple wherever possible, but do want to keep putting into practice the stuff that we've learnt, and would welcome any code ideas based on this from others. Please feel free to post on the site if you have something to share!

Jon Webb, 2 Feb 2012

I feel a lot of this post was directed at me (I used the splice function and started the thread on 52 sided dice).

I admire your stance on thoroughly learning and understanding what has already been taught. However I would point out I was just trying to move the discussion on from debugging to thinking more abstractly about the problem being posed to us because I found the solution in the course very limited.

I think the fact that you've taken the next step and moved to an array based solution shows that to an extent you agree.

I'm not trying to show off or dictate a solution, just pick brains and experiment. Best practise is a long term aim. Understanding must come first.

Thanks for sharing, I look forward to reading more.

madhaha, 3 Feb 2012

Hi Madhaha,

This wasn't directed at you , I didn't take any notice of who wrote what, I just remembered this particular thread when I wrote the blog post - that your posts stood out and were more memorable than others is probably a compliment!

My concern is not so much with people who are conscious of what they are doing and why - it is clear you do. This post was meant more as a warning to me and those new developers who are not so sure on their feet as you. It's very easy to start nodding your head and pretending to understand even though you don't have a proper grasp on what is happening (I have certainly been guitly of doing that).

And yes - I completely agree in terms of pushing and pracising the learning. There are loads of things that I want to do:

- Fullly complete blackjack game (as specified by me) prior to rest of the project going out.
- Design and develop a framework to better let me test my code (I'm VERY tired of writing cosole.log... in various loops/functions for different variables so that I can debug my code - and given how simple my code is right now, this is going to end up being a real pain!).
- Get a group of people together to work on collaborative projects. E.g. someone makes up with a brief, someone architects it (describes functions and what they need to do), different people create the functions which are peer tested, and then put together and debugged by the group.
- Then I'm wondering how feasable it is to write a framework to help facilitate this!
- Actually, there are loads things that I want to do and will try and do some of them (having a 16 month old child doesn't help in terms of free time).

The point I'm making is that with all the above, I want to to using my knowledge alone - however limited. I want to come up with the solution, even is this means that it is very inefficient, inelegant or even incomplete solutions. It's going through this thinking process that means that when there are functions introduced that do in 1 line what I managed in 30, I am happy to use them as have done the thinking and therefore they integrate with my knowledge properly. Basically, I want to be able to do whatever I do without an internet connection.

Didn't mean to cause any offence, and certainly not personal (I don't know you!) and as I say, do agree that homework will benefit learning, but only if we are actually learning and not adding un-anchored knowledge that we then build apon. It will end up coming tumbling down. You seem to know what you are doing so not a problem, but all don't.

Thank you for your comments, please do feel free to post any thoughts, solutions, or if you want to do something collaboratively, that might be fun too - and probably great for learning.

Jon Webb, 6 Feb 2012


We managed to write very similar code. Great minds must think alike ... or something like that. Your use of a switch statement is smarter than my if ... else statements. I didn't think it necessary to create an object for each card. An array for the shoe is sufficient.

Shuffling procedures are at the end. "Wash" is when the dealer puts all the cards on the table and swirls them about. "Riffle" is when the dealer splits the deck in two and alternates cards from the left and right piles. Curious to know what you think.

// Determine how many decks of cards.
// var numDeck = prompt ("How many decks of cards? [1 - 8]",1);
var numDeck = 1;
var numCard = numDeck*52;

// Create an unshuffled shoe.
var shoe=[];
function newShoe(){
for (i=0;i<numCard;i++){

// Convert card code to card value.
function getValue(cardCode){
cardNumber = cardCode%13;
if (cardNumber == 1){cardValue = 11;}
else if (cardNumber == 11){cardValue = 10;}
else if (cardNumber == 12){cardValue = 10;}
else if (cardNumber == 0){cardValue = 10;}
else {cardValue = cardNumber;}
return cardValue;

// Convert card code to card string.
function getString(cardCode){
if (cardCode > 0 && cardCode <= 13){cardSuit="♠";}
else if (cardCode > 13 && cardCode <= 26){cardSuit="♥";}
else if (cardCode > 26 && cardCode <= 39){cardSuit="♦";}
else if ( cardCode > 39 && cardCode <= 52){cardSuit="♣";}
else {cardSuit="";}
cardNumber = cardCode%13;
if (cardNumber == 1){cardNumber = "A";}
else if (cardNumber == 10){cardNumber = "T";}
else if (cardNumber == 11){cardNumber = "J";}
else if (cardNumber == 12){cardNumber = "Q";}
else if (cardNumber == 0){cardNumber = "K";}
else {cardNumber=cardNumber;}
return cardNumber+cardSuit;

var shoe = {count:0};

// Convert card code to card count.
function getCount(cardCode){
cardNumber = cardCode%13;
case 1 : return -1;
case 2 : return 1;
case 3 : return 1;
case 4 : return 1;
case 5 : return 1;
case 6 : return 1;
case 7 : return 0;
case 8 : return 0;
case 9 : return 0;
case 10 : return -1;
case 11 : return -1;
case 12 : return -1;
case 0 : return -1;
default: "err";

// Show the current state of the shoe.
function showShoe(){
console.log("ShoePosition CardCode CardValue CardString");
console.log(i+" "+shoe[i]+" "+getValue(shoe[i])+" "+getString(shoe[i]));

// Shuffle using a wash procedure.
function washShoe(){

//Shuffle using a riffle procedure.
function riffleShoe(){
var tmpShoe=[]; // Place cards in pile in front of the dealer.
var cut = randomBetween(shoe.length/2-5,shoe.length/2+6); // Divide the pile of cards in half .. sort of.
var leftPosition = cut-1; // What is the bottom card in your left hand?
var rightPosition = shoe.length-1; // What is the bottom card in your right hand?
var tmpPosition = shoe.length-1; // What position will the next card be shuffled to?

// How many cards will be released?
function howManyCards(){
x = randomBetween(1,7);
switch (x){
case 1 : return 0;
case 2 : return 1;
case 3 : return 1;
case 4 : return 1;
case 5 : return 1;
case 6 : return 1;
case 7 : return 2;
default : return 1;

// From your left hand, release 0 to 2 cards.
function fromLeft(){
interleave = howManyCards();
i = 0;
while (i<interleave){

// From your right hand, release 0 to 2 cards.
function fromRight(){
interleave = howManyCards();
i = 0;
while (i<interleave){

// Continue until all cards are released.

// Place shuffled cards in the shoe.
shoe = tmpShoe;

Loren, 9 Feb 2012

Hi Loren,

Thanks for this - looking forward to looking through this properly and will comment, but initial impressions are that this looks great!

Love the humanisation elements like the bit in the riffle where it is likely that one card is swapped across, but might be none or might be 2 - brilliant (at least I think that's what it's doing!).

The reason I used an object for the card was because a card has more than one property, and also card properties can change in different games - e.g. the ace in blackjack. Doing it this way means that hopefully it's adaptable more easily to other games, e.g. poker where the suit comes into play. Don't know if it's right or wrong, but also an excuse to practice with objects and methods (soon).

Will look over code ASAP and comment further. Thanks again!

Jon Webb, 9 Feb 2012

Hey, it's oni.1 from over in the Q&A section. I've seen some of your posts and I'm impressed at your lengthy code. It must have taken awhile, and you'll reap the benefit of knowing you could do it before CodeAcademy explains it at the end of the month! You are a programmer indeed.

I don't have much time to create new program in the Labs, but I occasionally post experiments, trying to get into the nitty gritty of the language and even CodeAcademy's console, on the Q&A.
I would say Objects 2 is riddled with errors and vagueness, tho. I haven't seen a lesson this bad since the pre-codeyear lesson "Getting Started with Javascript". That said, it's not terrible.

Anyway, keep up the work. Please post your stuff on the Q&A as well. I enjoy reading different code that plays with the concepts on there.

oni.1, 18 Feb 2012

week 7?'s courses on for while are poorly written. lot of spelling mistakes, bad sentence structure, very vague instructions, written from a programmer description rather than how someone would request you figure out a problem...combined with a programmer's description.

aaron, 21 Feb 2012

Hi Aaron,

Can't really comment on week 7 lessons - got to admit that I haven't had the time to complete week 6 yet, let alone get on to 7. Going to make a concerted effort to get on it soon (if my daughter decides to stop teething and let me sleep long enough)...When I do, I'll keep your comments in mind - I'm certainly finding the learning curve is ramping up much faster than I thought it would.

Jon Webb, 21 Feb 2012

Been slacking off with the codecademy stuff a little (I tend to work on it in bursts). Some thoughts on the code from a brief look:
Instead of hardcoding "quadrants" (ranges) of cards and assigning values, consider using a function/constructor to build a suit. This way your deck can accomadate additional suits for different games. Also you'll be able to reuse it if the game calls for you to start with less cards in a suit.

@Loren some interesting ideas but you're using a large number of cases in your switch statements to represent a range of numbers. It would be much more sensible in this case to use if...else and algebra. When you're comfortable with objects, please consider what I've said to Jon above. Also from a game design perspective, if your player can't see or hear the difference between a riffle shuffle or a wash, they will assume there is no difference. A lot of high tech AI design has been culled from games projects because of this.

madhaha, 21 Feb 2012

@madhaha - Thanks - that makes sense. When I wrote it it felt a bit 'clunky'. I think I may have just fallen into the trap of continuing down the road that I started on and building on it even though if I took a step back and looked at changed requirements afresh, it would be obvious that a different design was required. I'm thinking about going for a big push (catch up with CA lessons and then crack on with having a stab at a fuller blackjack game).

Though I've not done any coding, recently, have thought about the design of various objects and how they interact (table, players, hands etc). Perhaps I should write up my thoughts on design and get comments before doing anything else. One thing I'm learning is that getting the design right at the outset is key.

Comments like this that help me think about getting the design right are invaluable and will hopefully mean that problems don't come up when I actually put the design into action that otherwise would have.


Jon Webb, 21 Feb 2012

they did database maintenance in the middle of the day yesterday, and it messed up my progress in various areas. guess i need the practice.

i struggled with week 7's lessons. i really hope they put more/alternate lessons on sections to convey different approaches. time to take a break from their site and pick a book back up.

guess i am on base with oni regarding how vague some of the lessons and tasks can be.

i thin it is a good alternate method to get you up to speed fast on certain topics, but it is falling short in certain areas. there's a reason books have more content i suppose.

aaron, 22 Feb 2012

@aaron - Bad luck with the database maintenance thing. I'm not bothered if that's messed up my account in any way though - I think that as I've had such a long break (well a couple of weeks) that I'm going to need to do a bit of a recap anyway!

I reckon that you're right about books. I don't think that code year alone will make programmers out of us. For me though, I think that I'm using it more as a way of structuring my learning. Hopefully the overall design of the course is right even if some details are not quite there. So far, think that it's been reasonably on track in that respect (though I've not completed week 6 or even started week 7 yet!).

Going to get on it this weekend!

Jon Webb, 22 Feb 2012

@jon - good luck managing your time; i know how challenging that can be. don't get me wrong, i only thought a few of the numbers in the section were really vague or poorly written.

i guess saying i struggled with week 7's lessons made it sound like i struggled with all of them. only a few were too vague and, in my opinion, not well written. the main parts i struggled with involved not understanding what the writer was asking for until i "had to" use the hint, and even then on just a couple specific ones it just didn't match the presentation of the instructions. overall i think week 7 was beneficial, but i felt like i learned and applied more in other weeks.

very good site though, and an excellent complimentary to any book. it actually gets you up to speed on certain concepts really fast.

aaron, 23 Feb 2012

Very good article, Marcus! I like the Yes/No structure and it's written in plain English not nerd-speak ( or black hat speak!).

Helen Johns, 24 Oct 2012


I have the same problem on fresh install.
It works for me. The problem is that It show blank page even if I click on any order from list.

Jan?i, 21 Feb 2013

© Alberon Ltd 2018

8 Standingford House
26 Cave Street

01865 596 144

Oxford Web is a trading name of Alberon Ltd, registered company no. 5765707 (England & Wales).