Some people may have said that hackathons are a stupid ass idea where a bunch of people who have can’t afford to buy their own pizza spend 48 hours with a bunch of strangers and no showers.

Okay, well, maybe that was me.

I take it all back.

In my office

We kicked off our hackathon at noon on Monday and wrapped up at 8 pm on Tuesday. The rules were simple – everyone who was working those days was to wipe their schedule completely for 8 hours each day and do nothing but work on the game. No emails, no blog posts, no meetings except for a kick off meeting each day to assign and review tasks. Jessica, Dennis, Samantha and I worked on the game for (at least) 16 hours. Any emails or interviews got done before the hackathon hours or after they were over. (I did pause for a brief interview with the Bismarck State College paper.)

Maria came in from maternity leave and worked 8 hours on Monday, baby in tow.

CalGonzalo and Eric each worked their regular shifts on Monday and Tuesday, respectively, doing nothing but writing code, creating sprites and editing audio. Sam even pitched in a few hours early in the morning from Canada. Our massively talented artist, Justin, completed all of the new artwork before the meeting so we had it in hand to drop into all of the spots where there had been placeholders.

So, in two days a total of 100 hours were devoted just to game development. We made a giant leap forward.

RocksThe 3-D portion of the first level is nearly done.

Player needing helpThe new characters are being dropped into each scene.

Why did it work so well? For one thing, we were all in the same spot for a long time. Although the original plan was to meet and then people would go there separate ways, on Monday, five of the six people working stayed at my house. Three of us even slept there. That had two positive impacts.

First of all, whenever anyone needed something, whether it was a piece of artwork modified or a question answered on whether we had a sound file of footsteps in the woods or to be shown how to do a voice over in iMovie, there was someone else to provide that assistance right on the spot. Very often, you can spend hours searching for something on Google, watching youtube videos, reading manuals trying to figure out how to do X when someone else can come up and say – Click on Window, pick record voiceover, click on the microphone in the middle of the left side of the window.

There are also those questions that CANNOT be found on Google, like where the hell was the new background image saved and what is it called.

The second positive impact was we got around to tasks that needed doing for a long time. While it may have seemed it kept us from getting real progress done on the game, the fifth time Sourcetree complained about not tracking those damned Dreamweaver .idea files, I HAD it and we removed those from the repository forever. When something bugs you every now and then you may think, “I’ll do it later”, but the fifth time it happens that day …

Anyway, I would share more of the awesomeness of the hackathon experience with you but it is now 9 pm and we are taking the team out for sushi.

Our Project Manager, Jessica,  made the very insightful comment at lunch the other day,

No one cares how hard it was for you to make. When people are looking to buy your product, all they want to know is what it will do for them.

That young woman has a bright future in marketing. Unfortunately for those who read this blog, I do not, so I am going to tell you how hard it is to make that last push to the finish line.

tired eyes

I quit counting the number of hours I worked this week when I got to 80. I’m sure The Invisible Developer had put in even more, because many nights (mornings?) I have gone to bed at 2 a.m. and when I wake up and check the latest build in the morning I find it was put up at 5 or 6 that morning. There hasn’t been much blogging going on lately and I only have a bit of a minute now because I’m waiting to get the latest latest latest build so that I can make the Windows installer.

I’ve blogged before on the great value I place on “details” people and this week is a prime example of the importance of details.

You’d think that down to and past the wire – the last build of the game was supposed to be today and we have negative 68 minutes left in today – that we would be moving forward pretty quickly. Um, not so much.

At the beginning of development, you can easily find the problems – the question is what fraction of the fish are over one foot long when you caught 125 fish last summer and 25 were over a foot long. The correct answer is 1/5.  However, 25/125 is also a correct answer, as is 5/25 . Finding those problems is easy. You can check the answer while you are creating the pages, have it write to the console the correct answer, step through the logic. No problem.

Same thing with playing the 3-D part of the game. If you are at the part where you are supposed to be spearing the fish and there is no spear, then it is an easy enough fix.

HOWEVER, now we are supposedly at the end. So…

  1. We make a version of the build for Mac and another for Windows.
  2. We zip the Windows file because many systems block .exe files downloaded from the Internet to prevent malware installation.
  3. We upload the zipped file to our server.
  4. We download it.
  5. We play the game from beginning to end on Mac.
  6. We play the game from beginning to end on Windows.

That is, we go through every step that a user would — and somewhere along the way we find an error that we somehow missed in all of our earlier testing. Maybe something we fixed in a later stage of the game was a script that was used in an earlier level and now that doesn’t work.

So … we go through all of the steps all over again. Yes, we do have debugging capabilities where we can skip to level 6 and test that, for example, but at the very end, you NEED to go through all of the steps your users will. Trust me. You can put in every unit test you want but it will not let you know that Microsoft or Chrome or some other organization put on this earth to try my patience now has a security feature that blocks the game from installing. You won’t see that three problems and all of the accompanying instructional material were left out.If you start at level 6 you will miss the fact that there is a problem in the transition from level 5 to level 6. And so on ad inifinitum until you go to speaking in Latin and wanting to tear out your eyeballs.

We go through all of the details so that when you play it all you see is a game that works.

My high school English teacher told me,

If something is easy to read, you can damn sure believe that it was hard to write.

I think this is also true,

Any kind of software that is easy to use, you can damn sure believe it was hard to make.

 

This is the most depressing chart I have seen in a long time. Below are the results of our pretest on knowledge of fraction operations of 322 students in grades 3 through 7, attending schools on and adjacent to American Indian reservations.

chart of fractions test results

These are questions like,

“Drag 6/1 to the correct spot on the number line.”

Which was one of only two questions that at least 50% of the children answered correctly.

or

Identify the letter that marks 7/8 on a number line

14% of the children answered that right.

Then there are the word problems,

“Bob and Ted painted a wall. Bob painted 1/5 of the wall and Ted painted 2/5 of the wall. How much of the wall is left to paint?”

38% of the children answered that correctly.

Looks like they did better on item 7, which asks which of these statements is true

5/6 < 3/4
2/8 < 1/4
3/6 = 6/12
2/3 = 4/5

26% of them got that correct. Guess what? That was one of the few multiple choice items on the test, so random guessing would have gotten it correct 25% of the time.

This is a test of what is ostensibly third- through fifth-grade math. Two-thirds of the test is at the fourth-grade level or below. As our results indicate, the majority of the students who took the test would not understand what that statement means.

For the 163 fifth-graders who took our pretest, the mean score was 28%.

For the 114 fourth-graders, the mean was a dismal 14.7%.

It wasn’t that the students didn’t try. I looked and there were very few places they left the items blank. They simply did not know.

These students came from several different schools, and while there may be differences between schools,  there is nothing to suggest one school with abysmal results pulled down all of the others.

I called our lead cultural consultant, Dr. Erich Longie, out at Spirit Lake, and told him that I was concerned about presenting these results to the schools that they might want to shoot the messenger. After all, it is important to us that these schools continue to provide us their input and guidance. He told me not to worry about it too much.

“They know,” he told me, “As someone who has been a teacher and administrator in schools on the reservations, I’m not surprised by the results and I can’t imagine these schools will be, either. What we all ought to be worried about is making sure that the post-test scores don’t look like this.”

So … students will start playing Fish Lake in the schools next month. No pressure here.

pike

Excuse me while I get back to work.

I was reading a book on PHP just to get some ideas for a re-design I’m doing for a client, when I thought of this.

Although I think of PHP as something you use to put stuff into a database and take it out –  data entry of client records, reports of total sales – it is possible to use without any SQL intervention.

You can enter data in a form, call another file and use the data entered to determine what you show in that file. The basic examples used to teach are trivial – a page asks what’s your name and the next page that pops up says, “Howdy”  + your name .

We make games that teach math using Unity 3D, Javascript, PHP, MySQL and C# .

Generally, when a player answers a question, the answer is written to our database and the next step depends on whether the answer was correct. Correct, go on with the game. Incorrect, pick one of these choices to study the concept you missed. Because schools use our games, they want this database setup so they can get reports by student, classroom, grade or school.

What about those individual users, though? They can tell where they/ their child is by just looking at the level in the game.  So, I could drop the PHP altogether in that case and just use Javascript to serve the next step.

I could also use PHP.

In the case where we drop out the database interface altogether, is there a benefit to keeping PHP? I couldn’t think of one.

Still thinking about this question.

I’m pretty certain that I’m a woman in technology.

Last night, I was using SAS on a virtual machine through a remote desktop connection to prepare data from the National Hospital Discharge Survey for use in examples of MANOVA and multinomial logistic regression.

Today, I was working on improving animation in the Javascript for a browser-based game that leads into the 3-D portion of an adventure game I designed to teach fractions.

Next week, I will start on a contract to completely re-do the PHP/ MySQL database for a client to bring it to something more secure and up to date.

Oh, and I also was reviewing my notes for the graduate courses in biostatistics and advanced multivariate statistics that I’m teaching this fall.

Pretty certain that by any standard – writing code, founding companies, graduate degrees, university appointment, successful Kickstarter – I am definitely a woman in tech/ STEM whatever the day’s buzzword.

I read SO many articles, blog posts, tweets about the need for women in tech, women-led start-ups, women entrepreneurs.

If you ask me, the U.S. Department of Agriculture is the greatest proponent of women in tech that there is, because they have actually put up money and funded us to do a prototype of an adventure game that teaches math.

When results from that were positive, they funded us again with a Phase II Small Business Innovation Research award to develop the games for commercialization.

I have written here before about the troubling nature of the Black Girls Code, Latina Girls Code emphasis that seems to completely overlook the grown women who are here now. I am NOT saying those aren’t good programs. I assume they are but I have no personal experience. What I am saying is pretty much what I said in January.

It seems to me that when people are looking at minorities or women to develop in their fields, they are much more interested in the hypothetical idea of that cute 11-year-old girl being a computer scientist some day than of that thirty-something competing with them for market share or jobs. If there are venture capitalists or conference organizers or others out there that are sincerely trying to promote WOMEN who code, not girls, I’ve never met any.

(Since then, I have met a couple of conference organizers.)

I suppose Ada Lovelace was cool – my two-year-old granddaughter has a shirt with her picture on it. Still, I don’t think a trending hashtag of #fuckyeahadalovelace did anything for me as a woman in tech.

Fish Lake artwork

You know what helped me as a woman in tech? Seed money from the USDA. You can see what we did with it here at our 7 Generation Games site.

One thing Sheryl Sandberg got right in her book, Lean In, was that women tend to be judged on their accomplishments where men are judged on their potential. Of course, you also don’t want to be “too old” to be an innovator so by the time women have those accomplishments, they are past their prime as entrepreneurs according to those VCs who believe that people over 30 are too old to do a start-up.

It’s hard for me to complain about my life when my morning starts out with reading technical books with lines like, “Figure 1 shows the sprite with the red and green blood particles for player and zombie”.

My point is that our company is in the situation we are in not because of any “help minorities code” program but because USDA and our backers on Kickstarter gave us cold, hard cash to develop our products.

Want to help women in tech? Back them on Kickstarter. Buy their products. Tweet about their products and companies to help their marketing. Invest in their companies.

USDA got it right.

Thank you.

 

 

 

 

 

I’m working on a section of a game that teaches fractions. If a player misses the question about where to meet up with the returning hunter, he or she gets sent to study. There is a movie that plays before this about needing to get back to the camp before dark.

Here is the question,

“The sisters begin to worry their brothers won’t make it back by dark. They start down the trail to meet them. They decide to stop and wait at the spot where their brothers will be 3/4 of the way back to camp. How far FROM the camp will the girls be?”

trail

 

I used this question because I want students to think about a few ideas:

  • Distance between two points can be thought of as a whole.
  • If you are a/b distance FROM point X, the remaining distance TO point X is 1 – a/b  . Of course, I don’t expect them to state it like that.
  • 1/4= 2/8
  • Number lines can be numbered in either direction. You can have 0 on the left or 0 on the right. The distance will be the same. The size of each interval will be the same.

These are kind of important ideas in math – equivalence, the arbitrary nature of labeling points on a line.

Students can click on GIVE ME A HINT, and a hints page pops up that explains, among other things, why you were wrong if you answered that the sisters would be 3/4 of the distance to the hunting grounds FROM the camp. If, even after reading the hints, (or if they skip the hints and just guess, we’re talking kids, after all) they get the problem wrong, the player is sent to watch a video clip explaining the problem, and then has to take a quiz to get back to the game.

SO … I had the thought instead of writing the quiz questions out of thin air, I might read what some more experienced teachers were giving to students in this grade as math problems. After all, I haven’t taught middle school math since the 1980s.  I went to several sites, I even purchased some things like “One year of fifth-grade homework problems” etc.

When I looked at page after page of what students are being given as homework assignments, the only thing I could think was “Are you fucking kidding me? No wonder kids hate math.”

All of the homework was like this:

1/4 + 1/3 =   ?

For FIFTY problems. That’s it! Then, the next day, it would be another fifty problems like this:

5/6 – 1/4 =  ?

Okay, you need to learn to add and subtract fractions, but is that ALL you need  to learn? Obviously not. How boring must it be to sit and just calculate answers to the same type of problem over and over? This stuff made me start to hate math and I LOVE math.

How can you possibly think that is teaching kids math? That’s like making them copy down all of the words in the dictionary and pretending you taught them literature.

Don’t even get me started on teaching statistics – wait, too late. I’m started. That is my rant for tomorrow.

Last week was very productively spent at Unite 2014 learning about all things Unity.

In case you are not into game development, Unity claims to be used by over a million game developers around the world. While I rather suspect those statistics are up their with Second Life and Twitter counting everyone who ever signed up for an account, there is no denying that one whole hell of a lot of people use Unity for game development, including us. I have to say all of my major objectives in attending were met.

2d Game image

The first thing I wanted to achieve was make a definite decision whether to go with Unity for the 2D game for the iPad that we are going to dive into next month. We have some artwork, a rough design, but we’re coming up on the first point of no return decision. Well, there’s always a return, but if we start with Unity and then switch to solution X it may take us quite a bit of time to re-tool.

The decision was, yes, we definitely want to use Unity. My concerns about performance on lower powered devices were addressed. First, I spoke to some helpful folks from Unity who pointed out that you can set your game’s graphic quality ranging from Fastest through Beautiful to Fantastic. Yeah, those are actually the last two settings. I also attended a session on tips for working with mobile devices that gave me some good ideas, like if we have character that has a sword, instead of having two images, a sword and a character, have that be drawn as one image.

Two other clinchers for unity were

the number of platforms to which we could expand eventually – play station, xbox, android phones, smart TVs. Unity works with all of those. The same would not be true of code we wrote in javascript for the web.( Speaking of javascript, even though Unity supports both C# and javascript, I noted that the examples were overwhelmingly C# ones in the presentations and their seems to be a definite lean in that direction), and

the number of vendors with integrated add-on packages, everything from SpeedTree, which makes drawing trees fascinating to mixamo which offers a much simpler way for making 3-D animated characters. I was so impressed with mixamo that I texted one of our fabulous artists from the presentation, This is something we need to start using, and by we, I mean you, because we both know I suck at art.

The second thing I wanted to achieve was to get more familiar with Unity. That was achieved. I was able to follow the examples in the Training Day and do the Nightmares game, which was pretty fun. The next couple of days, in my spare time, I made another much simpler game from scratch for my grandchildren to play. It won’t win any awards for originality or anything else, but my Unity knowledge definitely spiked up in a week.

Screen shot of nightmares game

One reason I insist on going to events like this, even though people tell me that I am the CEO and should be doing CEO things, is that I would never, ever find 40 hours in a week just to learn  if I stayed back in the office. I’ve written before about the Red Queen’s Race in technology, where you need to run as fast as you can to stay in the same place. I turned 56 last week and more opportunities are coming my way than ever before, which I attribute to refusing to equate age with stagnation.

No brogrammer culture in sight

Speaking of age – I usually go to conferences on statistics – the Joint Statistical Meetings, SAS Global Forum, etc. Sometimes I go to start-up events. This was my first game developer conference and I had heard horrid things about the game industry, that women are sexually harassed, assaulted, disrespected.

As far as horrid brogrammer culture – didn’t see it, and I looked. The demographics were overwhelmingly male, somewhere between 90-95%, I would guess. None of the sessions I attended had a female presenter. On the other hand, I didn’t submit a paper. I suggested it to The Invisible Developer and he didn’t want to do it, and I was too busy with everything else. We decided next year, for sure we would co-author one and submit it. Should be fun.

My point is, I don’t  think they received hardly any submissions from women, just based on the number of women attending.

Despite all of the people who claim to have started coding in the womb and how much VCs supposedly drool over twenty-somethings, I saw about as many people under 20 as I did over 60. That’s based on me eye-balling it, I didn’t actually go around carding people. Given the amount of grey hair and balding, I’m going for the crowd was overwhelmingly in their thirties and forties.

While there were far fewer women than at statistics conferences, there were more than the zero African-Americans and Latinos you usually see at statistics events, although it was clear from the eavesdropping during the coffee breaks (I call it qualitative data collection) that many of these folks were actually from Latin America attending the conference. It was FAR more international than SAS Global Forum or JSM, even though both of those have a smattering of international folks.

As far as the whole sexual harassment, mansplaining, unwelcome thing – didn’t see it. Nada. Zip. Zilch. Every single person we met was nice, polite and interested in talking about game development. No one treated me like I was a second-class citizen and the only person who insisted on explaining stuff to me that I already knew was The Invisible Developer, but he has lots of other non-annoying traits that make up for it, so it doesn’t bother me.

It may be that I am old, plus I was there with my husband, so no one would bother me. However, I really did look, whether it was at cocktails in the evening, at lunch, during the coffee breaks, at the young women sitting around me in conference sessions  – and I did not see a single hint of the kind of bad behavior I’ve been hearing about. I’m a small person and at this conference, I was just there to hang out and learn stuff, so I was wearing jeans and a hoodie most days, my point being, there wasn’t any reason people would be on their best behavior around me.

I’m not saying it doesn’t happen. I’m saying I didn’t see it happen here.

All I can say is — you should go to the next Unite conference. Learn stuff about game development and people will be nice to you. What more can you want? Well, if you want more, I should add that Seattle had some awesome restaurants.

If you want to go next year, do jump on it right away when you see it advertised though, because everything sold out – the conference, training day, nearby hotels.

 

cake

I’ve spent a good bit of my life living and working in places that many of my colleagues would not drive through in the middle of the day with the windows rolled up and the car doors locked, so you’ll have to excuse me if I am a bit cynical about the latest push to teach everyone to code.

I’m not opposed to coding, in fact, I am greatly in favor of it. It is tied with drinking Chardonnay for favorite activity for which you do not have to get naked.  I was an industrial engineer in 1982 – so I was into STEM before STEM was even a thing.

What makes me roll my eyes and sigh is where many well-meaning people have completely missed the mark when they say that you don’t really need to know much math to write software. Clearly, they can’t mean all kinds of software because obviously if you write software to do statistical analysis, predictive analytics or whatever the phrase du jour is, you very much need math.

Often, these people are talking about games –

“Kids play games, let’s have them make them.”

That doesn’t necessarily follow any more than,

“I have a liver. I should create a dialysis machine.”

Ignoring the faulty logic for a minute, let me point out that most games DO require math. The people saying they don’t are usually people who are quite successful, both professionally and academically and have spent their entire lives around people much like them. What they mean when they say that, “Games don’t require much math” is

“I took three semesters of Calculus and a course in multivariate statistics and I rarely use any of that in making games.”

I, on the other hand, meet many people who can’t multiply two-digit numbers without a calculator and have never given a thought to the concepts of randomization, ceiling, floor or rounding. The vast majority of these people are perfectly intelligent enough to learn those things if ever given the motivation, time and instruction.

Here are a few lines from a super-simple game, “Canoe World”,  I wrote in the past two days. It’s a very common application. You can find it in the Game Design book by Rex van der Spuy and hundreds of other places. You randomly decide who is stronger, the player or “enemy”, one wins the exchange and points change  – a pretty standard game component.

function sink(thing) {
// The player’s strength ;
var playerStrength = Math.ceil((food+ health)/2) ;
var rockStrength = Math.ceil(Math.random()* playerStrength*2) ;
// Find out if the player strength is greater than the rock strength ;
if (rockStrength > playerStrength){
// The rock sinks the canoe ;
var lostFish = Math.round(rockStrength/2) ;
food -= lostFish ;
// Player gains experience ;
experience += 1 ;

 

To compute the player’s strength, I take the average of their food and health points, and round that up. That’s the ceiling function. To understand this, you must have some idea of order of operations – things in parentheses get done first – to understand that first I’m adding the two values and then dividing by 2.

You need to know that having that slash and then a number means to divide by a number.

That is math and not everyone knows it.

A ceiling function rounds up – and to understand that, you need to understand the concept of rounding.

To understand the second statement, you need to know what a random number is, that the * means to multiply. You also need to know that the random function generates a random number between 0 and 1 and realize that is a continuous distribution because there are an infinite number of numbers between 0 and 1.

That is math and not everyone knows that.

You’d have to realize that since the random number function is between 0 and 1, if you just multiply that number by the player strength it is ALWAYS going to be less or equal and the “enemy” will never win. Since, on the average, the random number will be .5, if you multiply by 2, that makes it equally likely the player or enemy will win and gives you a game of chance.

To change the probability of the player winning the exchange, you can make that number larger or smaller.

You need to know that the > means that the thing on the left is greater than the thing on the right.

All of that is math and not everyone knows it.

The people who want to teach kids to code assume that either,

a. Everyone knows this much math – in which case they are OH, SO WRONG!   or …

b. That they will work with the minority of students who do.

There is absolutely nothing wrong with option B. I wish you the best of luck with all my heart and will do whatever I can to help.

Most of what I can do to help is make games to teach math, so that more kids will fit with option B.

There is an option C, which intrigues me, and I have heard very few people discuss, which is to teach the math along with coding. That is certainly not impossible – but it would be hard – you would need students very motivated to put in the time and effort and teachers who were able to step back and start at whatever level of math competency required by an individual student.

This whole thing reminds me yet again of the comment made by Dr. Irv Balow, Dean of the UC Riverside School of Education. Frustrated by reading so much research that said under some conditions class size had an effect, under other conditions, not so much, for some students cooperative learning was a benefit, for others it was detrimental, etc. etc. etc. , a student asked,

“Isn’t there anything in education or psychology we know as absolute, unqualified fact?”

After some reflection, Dr. Balow replied, that the only thing he could be absolutely sure of was this :

“All of the simple answers are wrong.”

During the time since I started this series of posts on a little thing I knocked out one evening to illustrate long division, I’ve probably done a dozen other somewhat interesting pieces of code – I am sad that Java has co-opted the use of the word codelet because it is such a nice term for a bit of programming that is more than a function but not a real application. Anybody has a good word, let me know. While we’re on the subject of words, what exactly is the difference in Dreamweaver between an extension and a widget?

Anyway …. our games include hundreds of bits like this, where if a student misses a problem, he or she gets routed to a page to pick an option to study.

So … here is the rest of the story. Yes, it could have been done more beautifully, and when I go back and revise it, I think I will change the answer button instead of having two buttons to have one that is changed after the first onClick.

The DOCTYPE (html5) and title are pretty obvious.

All of our web pages have a container ID that is set in the style sheet. That makes all of the content fall within a defined window size, regardless of the screen size.

The w class is just so the background is white in the spot where the problem is. The Invisible Developer wanted some type of background and he liked the specky one.

You might wonder why something like w is a class instead of an ID if it is only used once. In fact, I simplified this example for the blog. Actually the w class is in an external style sheet so their could be pages with more than one element using this same style.

As a commenter on an earlier post pointed out (thank you!) it would really be better practice to give these more descriptive names like white_back because in the future I’ll probably be looking at this page and wondering what the hell ‘w’ was supposed to do. Of course, I can look in the style sheet, but it still is better to name things something descriptive.

You can see that the input field for the second digit of the answer is hidden, as is the button for getting another problem.

The forms have an ANSWER button because we found that students in this age group (9- 12 years) often type something by accident or as their first impulse. This forces them to think, at least for a second, whether or not they really meant that and gives them a chance to change  their mind. We added this at the request of several teachers after our first year of beta testing.

The table width is set at 40% and since the container width is defined, the table will always be the same size.
The q class (again, should be renamed and shame on me), has a border at the bottom of the cell. That is used to give the top part of the division problem and used again when each digit of the quotient is found and multiplied by the divisor. The product is then put in a cell with a line underneath.

The first input field is where the first digit of the quotient will be entered. Onclick this will be hidden and the correct answer shown in the element yans1. If the student had entered an incorrect answer, they’ll also get a message telling him or her it is an incorrect answer. All of this is handled by the javascript.

For the remaining rows of the table – the left cell is underneath the divisor, so it will remain empty. The right cell will have each step in the division problem entered, as the student enters the first digit and then the second.  Again, this is handled by the javascript, all I need to do is make sure the id values for each cell match what is in the script.

Once the problem is finished, the div with the id fin will be shown, as will the button for trying another problem. The student now can select one of three choices:

Get another problem (button3), go back and select another option for studying division, or take a quiz to go back to the game. Five correct answers and he or she can go back to playing Spirit Lake.

<!DOCTYPE html>

<html>
<head>
<title>Practice division</title>

</head>

<body >
<div id=”container”>
<div class=”w”>

<h3>PRACTICE LONG DIVISION</h3>
<p></p>
<h3 id=”hd1″> Enter the FIRST digit in the answer</h3>
<h3 id=”hd2″ class=”hidden”> Enter the SECOND digit in the answer</h3>
<input type=”button” class =”hidden” value=”ANOTHER PROBLEM” size=”5″ name=”button3″ id=”button3″ onclick=”window.location.reload()”>
<p></p>

<p></p>
<form name=”formx” id=”formx” >

<input type=”button” value=”ANSWER” name=”button1″ id=”button1″ size=”5″ onClick=”checkProb(1)”>
<input type=”button” value=”ANSWER” size=”5″ name=”button2″ id=”button2″ class=”hidden” onClick=”checkProb(2)”>
<table width=”40%” border=”0″ cellpadding=”0″ >
<tr>
<td width=”20%” >&nbsp;</td>
<td width=”20%” class=”q” ><input type=”text” name=”ans1″ id=”ans1″ size=”3″><scan id=”yans1″ class=”hidden”></scan>
<input type=”text” name=”ans2″ id=”ans2″ size=”3″ class=”hidden”><scan id=”yans2″ class=”hidden”></scan></td>
</tr>
<tr >
<td ></td>

<td></td>
</tr>
<tr>
<td id=”c” ></td>

<td id= “divide”>&nbsp;</td>
</tr>
<tr>
<td ></td>

<td id= “d”class=”d” >&nbsp;</td>
</tr>
<tr>
<td ></td>

<td id= “e” >&nbsp;</td>
</tr>
<tr>
<td ></td>

<td id= “f” class=”d”>&nbsp;</td>
</tr>
</table>

</form>
<div id=”fin” class=”hidden”>

<p></p>
<a href=”../learndividelong.html”><img src=”../scenephotos/arrowhead_point_left.gif” width=”130″ height=”70″ alt=”back arrow” />
Go back to study more</a>
<img src=”../scenephotos/smalls/handblue.jpg” alt=”blue hand” /> <img src=”../scenephotos/smalls/handyellow.jpg” alt=”yellow hand” />
<a href=”../quizzes/dividelongerquiz.html”>Take a quiz to go back to the game<img src=”../scenephotos/arrowhead_point_right.gif” alt=”next arrow” /></a></div></td>
<p></p>
</div>
</div>
</body>
</html>

 

Yesterday I posted the code to get the problem, now here is where we check it. As I said yesterday, may way of programming is to knock out something that works and then go back and make it work better, like a first draft for a journal article. So, this is my first draft.

Keep in mind the point here is NOT a quiz but for them to review and see how long division works. So, if they get the wrong answer, they get an alert message that this is the wrong answer, but then the correct answer is shown. This happens for both the first and second digit of the quotient.  There are two digits in the quotient in these problems. We are trying to show students that when you do long division, you find the first digit, multiply that by the divisor, write the product below the dividend and subtract. Then, you do the same thing again for the next digit.

Also, I showed using alert here, but we actually use a function we wrote in our game because there are problems with using multiple alert boxes in the same page with Unity. The alert is included here for generalizability. This post is the second half of the javascript. You also need a bit of css and html that I’ll put up next.

You can see the final product here.

This is one of hundreds of applets we have written that are just auxiliary to the main game. You get sent here to study if you miss one of the math challenges in Spirit Lake: The Game.

Here is what this code does in order …

When they type in an answer, it is one digit at a time. The function checkProb, if it is the 1st digit,  hides the input box and answer button for the first digit and shows the correct answer. It also shows the input box and button to answer the second digit. The correct first digit is shown.

The product of the divisor and that first digit is computed, set to a value for a new variable d1, and that is shown.

The result is subtract from the dividend, and that result, e1 is shown but with a space included so the digits are lined up correctly.

If their answer is wrong, a message is shown telling them it is wrong and what the correct answer is. Actually, that message comes up first so once they click OK they can see the correct answer, product, etc.

Then, they enter the second digit and all of the steps execute again. After they have done a complete problem, the instructions on how to complete the problem are hidden and two new options are shown, to either get a new problem or go back to the game.

function checkProb(num){
this.num = num ;
if (this.num == 1)
{
var theirs = document.formx.ans1.value ;

$(“#ans1″).hide() ;
$(“#hd1″).hide() ;
$(“#button1″).hide() ;
$(“#hd2″).show() ;
$(“#ans2″).show() ;
$(“#button2″).show() ;
document.getElementById(“yans1″).innerHTML = rightans1 ;
$(“#yans1″).show() ;
var d1 = rightans1*divisor *10 ;
var e1 = dividend – d1 ;
document.getElementById(“d”).innerHTML = d1 ;
$(“#d”).show() ;
document.getElementById(“e”).innerHTML = ‘&nbsp;’ +e1 ;
if (theirs != rightans1){
alert(“Sorry,the correct answer is ” + rightans1) ;
}

}
else if (this.num ==2)
{
var theirs = document.formx.ans2.value ;
var d2 = rightans2*divisor ;
document.getElementById(“yans2″).innerHTML = rightans2 ;
document.getElementById(“f”).innerHTML = d2 ;
$(“#f”).show() ;
$(“#ans2″).hide() ;
$(“#yans2″).show() ;
$(“#fin2″).hide() ;
$(“#fin”).show() ;
$(“h3″).hide() ;
$(“#button3″).show() ;
$(“#button2″).hide() ;
if (theirs != rightans2){
alert(“Sorry,the correct answer is ” + rightans2) ;
}

}
}
</script>

Next Page →