frequency tables in statistics

Frequency tables are a way of groping various outcomes in a sample or population in statistics. That is when running threw a population, or a sample of a population of data there are going to be instances in that sample that meet a cretin criteria, and thus can be grouped in that criteria. Say for example you have a collection of grades for each student in a class, there is groping them by a letter grade, or by a number range. In any case the result is a table where all the students fall into each group, and there is a count for each group, such a table can often be called a frequency table.

There are many other ways of breaking down a large population of data down into smaller groups depending of course on the nature of the data. However a table is often a good way to go about displaying the data in general, in this post I will just be focusing in the concept of a frequency table though when it comes to just having two columns, one for some kind of thing to count, and the other for that count. When it comes to doing so, the data can then be used to find other things of interest such as percentages for each item that is being counted.

Read More

An input controller canvas example

Todays canvas example post is on something that I started working on that can be though of as an input controller for various input devices that might be on a range of client systems. This input controller would help with abstracting mouse, touch, and keyboard events into a single input state object that I can pull values from within a loop, or attach events to. At times it seems that doing something like this is necessary because of all kinds of problems that come up with trying to get control of something to work nice with a range of options for doing so.

The motivation for this is that when making a canvas project I want to make use of input from an array of sources, and a quick and simple process for this would be nice as I find myself wasting time writing the same code over and over again for this part of the process of making a project.

Most frameworks such as phaser will have an input controller, or input hander of sorts that can be used to quickly get up and running with user input. However when it comes to making a canvas project from the ground up I will need to make my own solution for this sort of thing, along with my own state machine, and so forth when it comes to making my own framework. So this post will be on my input controller canvas example that makes use of mouse, touch, and keyboard input and will be my own vanilla javaScript solution for this kind of thing. In the process of doing so I might also manage to make various utility methods that help with the process of creating a more comprehensive way to dealing with input.

Read More

World simulator canvas example

I want to start making at least a few more canvas examples that are the kind of example that I will be coming back to a few times. In other words the kind of canvas example that might prove to be a bit more that just a center piece to write about in a blog post before moving on to the next thing. That kind of habit is something that I would like to break with at least a few of these canvas examples.

I was happy with how my grid gradient canvas example came out as it is was a canvas example that I put a little more time and effort into than usual compared to most of these thus far. The main reason why I liked working on it so much was the plug-in system, this turned out to be something new and interesting for me. However that canvas example was just an eye candy type thing, it would be nice to start another canvas example that is something a bit more than just a nice visual effect of sorts.

So this canvas example will be similar to the grid gradient example, but this time I will be aiming for the start of a world simulator type project, something maybe vaguely similar to the game sim earth. Such a project is not the kind of project that I am going to complete in just a day or two, and even then I don’t think I could write everything about it in a single post. So this canvas example will be a starting point or core of such a project as it will be a long time until I get something that is really something like sim earth.

So lets start out with just a core world.js file along with some additional dependencies, and just one plug-in file for the core of this project. For now I will just want to get the basics of this worked out before going crazy with plug-ins for it.

Read More

Search destroy and spawn canvas example

For todays canvas example post I thought I would make a simple example that is some display objects moving around a canvas, some of which are destroyed by others, and they just keep spawning back. There will be just two types of display objects one of which is none, and the other is a hunter type that will attack other display objects.

So then these Hunters will hurt non hunter display objects, and any display object that will have zero hit points will be purged from the pool of display objects. There will also be a simple method for spawning display objects back into the pool of display objects or in other words a spawn method of sorts.

So this canvas example will just be an exercise of many aspects of canvas projects that has to do with just spawning, and purging display objects from a pool. This is a task that comes up in one form or another for all kinds of game projects, as well as simple animation or digital art type projects such as this one. In addition it is also a basic exercise of creating a primitive AI when it comes to how the hunters, and also how non hunters behave. When it comes to AI that is something that I do not have as much experience as I would like, so working out example such as this now and then is just what needs to happen in order to address that. Anyway for now I will be keeping the AI, if I can call it that, stupid simple, however that is yet another part of this project that I intend to make a focal point of sorts if I keep working on it.

Read More

Kaboom game clone for the Atari 2600 canvas example

Time for yet another one of my canvas example posts, this time I thought I would make a canvas example that is a clone of the classic video game called kaboom that was ported to systems like the Atari 2600. This is a game that involves a character at the top of the screen called the mad bomber that moves back and forth across the the screen dropping bombs. The object of the game then is to catch these bombs rather than avoid them with a player controlled bucket that moves from one side to another. If one of the bombs is missed then all the bombs on the screen blow up, and you loose a bucket. You keep playing until you loose all you buckets and like many of these classic games the object is all about just getting a hight score and that is about it.

The nice thing about cloning some of these other games is that doing so if often fairly simple in a modern javaScript environment. Back in the 1970s it was way hard to make games like these, but now I can often slap a working prototype of many of these games together in a single day often. In addition even with very simple games such as this there is much room for originality, not just when it comes to skinning the game, but the logic also. For example there is working out how many levels there should be until the player hits the max level, how many points a bomb is worth, and many other little details such as the rate at which bombs are dropped.

So it can be fun, and interesting to clone a game like this, and play around with all the little details.

Read More