the-krisney-way

Find my designs on awesome products by clicking here!

iTimeOut: NEW GAME!

Play Now by clicking here!

30 Days of Disney Jobseeking Advice

When jobseeking seems a little too boring. (April 2021)

The SLA Experience

Upcoming: A day in the life of an SLA.

It's a Kristen thing...

You probably wouldn't understand. :)

Monday, December 6, 2021

Arduino Antics: Laser Maze

Laser Maze

These tasks were done as part of MSc Creative Technology, 2019. 





Introduction


One at a time, each person gets a chance to move through the maze without hitting any beams. If a beam gets hit, red flashing lights and an alarm signal that the game is over. If the person makes it to the end and hits the huge stop button, the win is accompanied by green flashing lights.

Implementation


The 4 green lasers are lined along one side of the room, all wired in parallel to 3 D cell batteries. They are not connected to the Arduino in any way. On the opposite side of the room, there are 4 Light Dependent Resisters inside of plastic tubes. 

The LDR cells detect the laser light, and the tube helps filter out other unwanted light from strobe lights. The Arduino is programmed to watch the LDR cells, and the stop, start, and reset buttons. The Arduino sends 4 signals back to the Processing code on the laptop: start, stop, alarm, or reset. 

The Arduino also powers a servo that turns on a spinning red light when the alarm is set off.(you can delete the code if you don't want a beacon) The Processing code accepts the signals from the Arduino, and displays the state of the game on the monitor outside.

Evaluation



Processing and Reactivision in action

Turns out, it didn't work as well as it should have. With the little time we had to work, we had only one shot to try it out before it was used for the event. We got a smoke machine with the immediate fire alarms disconnected.

You could probably guess what happened next. Yes! We started a "fire". We didn't technically start a fire. The alarms just went off, disrupting class for pretty much everyone. Fun times.

Tuesday, November 16, 2021

Playing With Kinect: AR Sandbox

AR Sandbox


Introduction


An augmented reality (AR) sandbox is a 3D, interactive, dynamic educational tool to help understand mapping, topography, watersheds, natural hazards, and more! This tool uses a motion sensor and specialized computer software to map contour lines (lines of equal elevation) onto the sand that adjust to the elevated levels of the sand in real time. It's a fun, and addictive, way to learn through play for the young and the young at heart.

It comprises of:
  • A first-generation Kinect
  • A short-throw digital projector
  • A sandbox for your sand (our sandbox is 40" by 30" by 8")
  • Roughly 200 lbs of white sand
  • A Linux-friendly computer with fast NVIDA GPU, running Ubuntu 14.01 or 16.04
Playing with the AR Sandbox

Setup and Play


Assuming everything is connected and software is downloaded, the first step (after switching everything on of course) was to calibrate the kinect device and align it to the base sandbox. The depth view needs to cover the entire interior of your sandbox. It's okay if it overlaps slightly.

There were a couple of steps to calibrate the corners of the projection, the alignment and elevation to cover the projection. After all the boring (and insanely annoying) part was done, we finally got to the sand part - the most exciting part.

Next step - fill the sandbox with white sand. And after that, the fun begins! We started creating islands and different shapes and messed around with the water and "rain".

The resulting augmented reality (AR) sandbox allows users to create topography models by shaping real sand, which is then augmented in real-time by an elevation color map, topographic contour lines, and simulated water.

Evaluation




Processing and Reactivision in action

The AR Sandbox has numerous functions. From natural disaster planning and preparation, to out-of-the-box learning and education.

Wednesday, November 10, 2021

Java: Data Analysis

Data Analysis (Sharks)

Computer Science assignment, 2017.   You can find the project code by clicking the Github icon. ->GitHub



Introduction


Given a text file with data representing various features and aspects of sharks, read the file, write some functions to produce the required output and save the results in a text file. These were the requirements given for the various tasks.

Each line in a text file was represented as a shark, and each feature was separated by a colon (:). The given tasks were split into three. 

The first task asked for numeric analytics, like the largest and smallest sharks, as well as counts of words and strings. The second one played on a grouping principle, grouping all the sharks by region. Finally, the third task was to implement a search feature through the Latin name of the shark, which was one of the features in the given data. All these tasks are detailed below.

Code and Analysis


The reading in and writing to of the data was standard across all the tasks. To further simplify the analysis, a Java class, Shark, was created. This class contains a blank constructor and one that requires the following features:
  • Common Name
  • Latin Name
  • Maximum Length of Growth in cm
  • Maximum Swimming Depth in m
  • Maximum Young
  • Global Presence Indicator
  • Oceanic Regions
It also contains getter and setter methods and a toString method - all basic elements of a class.

On initial composition of the main file, a function required to open up the file and parse the shark data was created. The line is split by the colon delimiter and the sharks are added to an array.

Task 1

a) The three largest sharks by length - This required sorting the array by 'Maximum Length of Growth in cm', in descending order and printing the first three names.

b) The three smallest sharks by length - As with (a), sorting the array in ascending order would suffice. And print out the first three.

*Alternatively, run a sort in ascending or descending order, and print out the respective three required for (a) and (b).

c) The total number of letters (excluding spaces) of all Latin names -. A simple counter variable along with a for loop that runs across all 'Latin names' works. For each shark, 'strip' off the space and add the length of the string to the counter variable.

d) The total number of unique words contained within all Latin names with an even number of letters - Adding each name (or part of the name) to a set should remove all duplicates. With a for loop, count the number of letters in each word. If even, add one to a counter variable.

e) The total number of unique words contained within all Latin names with an odd number of letters - The same implementation as (d), except you count the odd, instead of the even.

** Alternatively, you can do a count of even or odd, and subtracting the count from the size of the set will give you the other result. Words in the set can only either have an odd or even number of letters.

Task 2

a) For each unique region, print the common names of the sharks - 
Start off by finding all the unique regions. You can either have these in a set (the easier way as sets don't allow duplicates), or filtered in an array (I used array as this proved useful for other parts of this task). 

As the results have to be printed in alphabetical order, sort the array.

Run a for loop (or a bunch of them). For each region, check against each shark's oceanic regions. If it exists, add the Common Name to a colon-delimited string. Split the string and sort the array in alphabetical order. Print the results for each region. 

Task 3

a) Prompt the user to enter a search string. Match the input string to Latin names of the sharks and print the common and Latin name (with search string in uppercase) - 

For each shark, check if the Common Name contains the search string (converting both to all lowercase). If it does, find the respective sub-string indexes and convert to uppercase. Add the common name and Latin name to an array (or two arrays). Sort the array alphabetically by Common name and print results.

If no results, print No Results Found.

Sunday, October 17, 2021

Unity Project: Outside In

Outside In

This project was done as a part of the Creative Technology course assignment, 2021.   You can find the Unity project by clicking the Github icon. ->GitHub

Introduction


The theme behind this project was to find a way to bring the outside world inside. With technology that can allow us to do this, we chose to do an AR portal. These allow people to hold up their phone, cast a doorway into another world and walk through it! The content through the door can be a 360 video or a completely computer-generated environment. 



Context and Audience


With an interest in Pokémon, especially with the new Pokémon Movie, Detective Pikachu, so drawing inspiration from that, the augmented room I decided to portal to was going to be an abandoned science lab used for Pokémon (like in the movie).
The intended audience proves to be children and teenagers. But this would be suitable for any Pokémon fan.

A little backstory (with the Pokémon involved in this project): A group of scientists are offered funding into genetic research if they agree to try and clone the greatest ever legendary Pokémon, Mew, the result is success and Mewtwo is born. However, Mewtwo is bitter about his purpose in life and kills his masters.

Design


The user would be able to step into the abandoned science lab and explore. There will be certain features and objects in the scene that will allow the user to interact or play with them. This app can further be extended into a game or can move into multiple portals.

AR portal room plan
The user starts out with placing the portal. Upon entering the room, the user is placed into the abandoned Pokémon lab. The user can then walk around and explore the surroundings. Colliding into the PC will turn it on, triggering a flash or series of sparks. A translucent Mew appears from the Mewtwo chamber and starts flying around.

Extended functionality: There would be a bunch of Pokéballs lying around with Pokémon you could let out and play with.

Development


Starting with the building of the room, all the assets and models were collected or built and placed in the environment.

Following a tutorial, the base setup of the portal was done. Most of the materials seemed to fade off well with the shader, but others were giving a little trouble. After going through a lot of material, the elements outside the portal seem to disappear well.

Not all the materials were responding to their given materials, so there were objects placed without materials for the purpose of completing the scene. Given more time and focus, more functionality could’ve been added to the scene.

Another (still existing) problem was that the portal kept moving a little along with the user, which meant that you needed a lot of space to move in and around.

Evaluation




Final video project: GlobAR


Japonia


Our class thought up the idea of having a collection of "doors" to go through, more like the Monsters Inc. concept. Since we had all picked ideas and themes related closely to Japan, Japonia was born.

Japonia portal map

Japonia consisted of:

In future for Japonia we would like there to be hidden worlds, tasks in AR such as overlapping interfaces that interact with the real world and fantasy ones in AR. 
In later development, we would like Japonia to feature more portals, varying styles and designs, some that are unlock-able by finding keys in the smaller portals.

Sunday, October 10, 2021

Processing and Reactivision

Processing and Reactivision

These tasks were done as part of MSc Creative Technology, 2019.   You can find the project code by clicking the Github icon. ->GitHub



Drawing a Robot


Being initiated into a language like Processing, similar to Java, but dealing on the graphics side of things. Given an ease into the language, the task of drawing, and possibly animating, a robot. Covering basic for loops and lines, I drew a robot similar to Eve from Wall-E.

To make things more interesting, I decided to add blinking eyes. Using a counter variable, I achieved the effect, drawing "closed eyes" when needed. And finally, in the spirit of "hello-worlding" a new language, I animated it Pokemon style, because why not.

Controlling a Puppet


Given an interesting brainstorming session to come up with weird ideas and uses of input devices, the Rubix cube in the corner of the room caught my attention. I became thrilled with the idea of experimenting with hiding the squares, moving and rotating the sides and overall control of the device.

You can read more about it here.

Evaluation




Processing and Reactivision in action

TUIO and Reactable


TUIO is an open framework used to read and interact with multitouch surfaces. It allows for transmission and processing of interactive states, including touch events and object states. It is most commonly used with the Reactable, which can be used for various purposes - teaching, music, etc.

Although not thoroughly used in this project to full capabilities, I hope to get the chance to work with it.

Monday, September 27, 2021

Fun With Racket: MIRTO Bots

MIRTO Bots



What is MIRTO?


MIRTO (the MIddlesex  Robotic plaTfOrm, also known as Myrtle) is an Arduino+Raspberry Pi platform currently used for teaching in the first year of the Computer Science degree at Middlesex University. It is developed as an open-source platform and the design and source code are available online.

MIRTO bot at Middlesex

A base layer incorporates Infra-Red sensors, bump sensors and a pair of HUB-ee wheels.In the center, an Arduino Uno collects the data from the sensors and is connected to the wheels to drive them. The top layer for Computer Science students is a Raspberry Pi that is connected to the Arduino Uno board by means on a serial connection on the GPIO pins.

Computer Science students will work mainly at the Raspberry Pi level, possibly extending the core platform with additional features (USB cameras, a fourth layer on top, etc.). More importantly, the platform offers a number of opportunities for teaching core Computer Science notions: from product of finite state machines to concurrency and synchronisation when reading the encoders, from networking at all levels (IP, TCP, applications) to data structures, functional programming, etc.


Projects and Code


Although I didn't track all projects, the MIRTO did make quite a few appearances in my first year of university.

Project I: Follow The Path

We started off planning, as a group, how we would approach testing the robot.  We initially went with the worksheet as a guide and start-up for the direction to go.  

Initially, we wanted to see if it would move, so we recreated the program we saw on the scratch worksheet and tried to see if the robot would react, which it did, once we connected to it. We also made the Hello World text show up on our LCD screens. 

We started off with a basic ‘U’ track on the table, with a piece of tape. Our code explains that “If the mid sensor (1) is greater than 500 (used as a constant value, chosen by trying to keep the robot on the tape), then the robot should move forward, else it should stop.”

Follow the part - U track

Working on MIRTO with Scratch

An issue that we encountered is that the robot increased in speed when it got to the turning point and then fell off the table. We initially assumed that the issue was the sensors, however we found out that using 200/100 was too fast and so the robot would drop from the table. We then changed it to 100/50 which meant the robot would drift across the table without falling down.

Final code

We finally came to this conclusion through trials with different functions and variables. We did try it out, but we were not so successful in making it work. Initially, it did work and we added on parts for it, and it did diverge from the track a bit.

Project II: MIRTO Orchestra

Sequence diagrams: connecting to MIRTO bots

First phase included selecting the music and then converting musical notes into its corresponding frequency in Hz.

We had to use ASIP (library created by MDX) function called playTone which has a signature of playTone : (Hz , ms) -> (sound). We also had to convert the time of musical notes into milliseconds.
Facing a problem of synchronization, we tried multiple ways of running the files of the different voices; we tried the Putty version on which we would try to run both at the same time. 

Then we found Putty Connection Manager which made that task easy for us. Even after that we still had synchronization problems. Eventually, we realized we would have to connect the robots to a network. We have done that by creating a file with a TCP listener which connected to an IP and would receive an Input and then reply with the Output. The input: Frequency in Hz and the Time in Milliseconds.

And now we had to create a conductor to send the instructions to the multiple robots.
We created a function that would send those values and by some miracle, it all worked.
Having the problem of synchronization solved we only had to put together all the functions containing the music in the conductor file.

Finally, we created a video demonstrating our work and also a Website on which you can play the music and also read step-by-step our work.






Tuesday, September 21, 2021

Fun With Racket: Morse Code

Racket Morse Code

Learning to code with Racket, BSc Computer Science, 2016.   You can find the project by clicking the Github icon. ->GitHub

Introduction


When learning to code, it's always practice... practice... and more practice. Even if it has nothing to do with career development or a project assignment, or simply useful, practice is the most important thing.

To play around with data types in Racket, particularly lists and structs, I set myself a project working with Morse code (because why not), mostly because I could use it on multiple fronts. Text-based output, GUI display, and simple output with the Arduino.



Racket Environment


Racket is a programming language - a dialect of Lisp and a descendant of Scheme. It allows functional programming and other different models and ideas that programmers aren't even aware of. It's not the most infamous when it comes to languages, but it is a great starter and easy-to-build concepts and training.

The environment, Dr. Racket, is quite intuitive and once you get to know it a little better, it can become incredibly easy to understand. It usually works in a read-eval-print loop, or REPL. Imagine your machine just sitting there and waiting for something to read. Once it gets it, it evaluates and then prints the result.

Dr. Racket Environment

Implementation


As mentioned in the Introduction, there were three parts to this so-called "practice" project.

Part I: Text-based (console) output

Experimenting with different data types (sets, arrays, structs, lists), I found out that the best structure for this project is lists - more specifically, nested lists. Using lists to build a dictionary of alphabets and the morse code equivalent, using basic conditionals and loops, I set up the function to translate strings to morse code.

Dictionary of alphabets (nested lists structure)

Console code run

Part II: GUI

With the basics all completed, I further implemented a GUI-based application after covering the lessons during university classes. I added a little Disney magic to it because I practically live and breathe Disney.

Using black and red square images, and some blink code to change the images to blink 1 second and 2 seconds for dots and dashes respectively,  I managed to "animate" a sequence based on user input.

Racket GUI: Black square blinks

Part III: Arduino

Finally, I wanted to test my hardware knowledge. I'm not the biggest fan of dealing with hardware but might as well make it something that I was interested in. It didn't take much coding to get the setup done as I already had the base functions down.

After connecting to the GUI, based on user input, the bulb (connected to Arduino) would blink to match the GUI.


Evaluation




Final video project: GlobAR



Thursday, September 9, 2021

Java: Travelling Salesman Problem

Travelling Salesman Problem

Artificial Intelligence module, Computer Science 2018.   You can find the code by clicking the Github icon. ->GitHub

Overview


Given a set of cities and distance between every pair of cities, the problem is to find the shortest possible path that visits every city only once and returns to the origin. The problem is a famous NP hard problem. There is no polynomial time known solution for this problem.

The project aims to build a system in Java that solves travelling salesman problems. The travelling salesman problem is to go to each city exactly once and return to the start. Solving the problem should give a path and the length of the path. There are optimal solutions, that is solutions with the shortest path.

Algorithms Used


Depth First Search

The DFS is the most fundamental search algorithm used to explore nodes and edges of a graph. It runs with a time complexity of O(V+E) and is often used as a building blocks in other algorithms. A Depth First Search plunges depth first into a graph without regard for which edge it takes next until it cannot go any further, at which point, it backtracks and continues.

For the coursework, the use of the DFS is basic. It prints out a single path starting from a starting city. It doesn’t necessarily take the optimal path, but it goes through all the cities and returns to the origin.

Dijkstra’s Algorithm

Dijkstra’s algorithm is a Single Source Shortest Path algorithm for graphs with non-negative edge weights. You maintain a distance array, with length n (n = number of nodes) and the distance to every node is initiated as infinite. 

A separate array, parent, is created. Value of parent[n] for a specific node, n, stores parent node of n in shortest path tree. Parent of origin node is -1. Whenever we find shorter path through a node, we make it the parent of current node. This, joined with the nearest neighbor technique, is used as a partially effective way of finding the shortest path. It does get close, but it isn’t always right.

Brute Force

The Brute Force technique consists of methodically computing all possible candidates for the solution and checking the cost of each possible tour, returning to the origin. It does achieve the optimum path, but it is very computationally expensive. This runs with a time complexity of O(n!), where n is the number of nodes in the graph.

Dynamic Approach

The Dynamic Programming solution to the TSP significantly improves the Brute Force technique, taking it from O(n!) to O(n^2*2^n). The main idea is to compute the optimal solution for all the sub paths of length n (n = number of nodes), while using information from the already known optimal partial tours of length n-1.

To compute this, we need to store two things from each case: Set of visited nodes in the sub path, Index of last visited node in the path. The best way to represent the set of visited nodes is to use a single 32-bit integer (as stored in the cache table).

Training Data


The training data provided were four files with a fairly small amount of data. Having looked at the results, the Dynamic Approach would seem to be the likely optimal way to search the space.

Test Data


The test data provided were four text files. The Dynamic Approach did prove to work consistently in this space, given a larger amount of data. However, after forty points, it did seem to give a little trouble.

Conclusion


While there are numerous solutions and algorithms to work through this problem, there is no one right answer and all depends on the search space and depth. The Traveling Salesman Problem (TSP) is believed to be an intractable problem and have no practically efficient algorithm to solve it. 

References


Baeldung. (2018). The Traveling Salesman Problem in Java | Baeldung. [online] Available at: https://www.baeldung.com/java-simulated-annealing-for-traveling-salesman [Accessed 10 Dec. 2018].

Bari, A. (2018). 4.7 Traveling Salesperson Problem - Dynamic Programming. [online] YouTube. Available at: https://www.youtube.com/watch?v=XaXsJJh-Q5Y [Accessed 11 Nov. 2018].

Fiset, W. (2018). Graph Theory Playlist - YouTube. [online] YouTube. Available at: https://www.youtube.com/playlist?list=PLDV1Zeh2NRsDGO4--qE8yH72HFL1Km93P [Accessed 12 Oct. 2018].

GeeksforGeeks. (2018). Printing Paths in Dijkstra's Shortest Path Algorithm - GeeksforGeeks. [online] Available at: https://www.geeksforgeeks.org/printing-paths-dijkstras-shortest-path-algorithm/ [Accessed 9 Dec. 2018].

GeeksforGeeks. (2018). Travelling Salesman Problem | Set 1 (Naive and Dynamic Programming) - GeeksforGeeks. [online] Available at: https://www.geeksforgeeks.org/travelling-salesman-problem-set-1/ [Accessed 9 Dec. 2018].

Google+, f. (2018). Applying a genetic algorithm to the traveling salesman problem. [online] Theprojectspot.com. Available at: http://www.theprojectspot.com/tutorial-post/applying-a-genetic-algorithm-to-the-travelling-salesman-problem/5 [Accessed 03 Dec. 2018].

Programming-algorithms.net. (2018). Travelling salesman problem. [online] Available at: http://www.programming-algorithms.net/article/48915/Travelling-salesman [Accessed 9 Dec. 2018].

Saurel, S. (2018). Calculate shortest paths in Java by implementing Dijkstra’s Algorithm – All for Android, Android for All. [online] Ssaurel.com. Available at: https://www.ssaurel.com/blog/calculate-shortest-paths-in-java-by-implementing-dijkstras-algorithm/ [Accessed 9 Dec. 2018].

Wednesday, September 1, 2021

Unity Project: Location Based PacMan

Location Based PacMan

This project was done as a part of the Creative Technology course dissertation, 2021.   You can find the Unity project by clicking the Github icon. ->GitHub

Introduction


This was done as part of the GlobAR project (click here to read more), but still deserved to stand on it's own. Out of pure boredom and nostalgia, I was playing PacMan one evening, while getting my mind away from a bug on a project I was working on.

Somewhere in that frustration, I thought up a Location-based version. Imagine actually being chased by a PacMan ghost, running around getting points and power-ups. I found it funny - funny enough to try creating it. It has the potential to be a great work out app, or just a fun game to play.


NavMesh and Unity


NavMesh, short for Navigation Mesh, is a Unity package that helps create walkable surfaces in a Unity game, allowing players to calculate walkable routes, between two locations in the game world. Documentation on this was limited as it was mostly for static planes and/or 2D game environments.

When getting it to dynamically generate with the map on Play, the building meshes, and materials seemed to fade and turned into a light blue tint that would occasionally flash. Using a NavMeshAgent, I was able to create a quick enemy to catch the user’s character (simulating PacMan). Accessing the app on a phone created too much lag to continue with the project. Exploring a different method might have been a better way to go.

Development


Moving away from AR based applications, I thought I would focus on the geolocation. The idea of real world PacMan seemed almost impossible to pass up as I thought about it. Not only would it be interesting, but it would also make for a good run. Of course, during these times, it may not be so accessible due to lockdowns and staying indoors. 

Making the map walkable was not very wise in this case, as the NavMesh component (explained in Section 6.2.2) I had used was not very compatible with the application. The use of the NavMesh component was to enable to enemy character to follow the player to real world positions.

Evaluation



Final video project: GlobAR

During such a chaotic time, with COVID-19 and the lockdowns, working with locative technologies and testing it proved to be limited. Even when it came to being at home and working, I made the most of what I could. There are a lot of techniques looked at throughout this project.

Tuesday, August 24, 2021

Unity Project: World Craft

World Craft

This project was done as a part of the Creative Technology course dissertation, 2021.   You can find the Unity project by clicking the Github icon. ->GitHub

Introduction


Geolocation has become a growing technology and is widely appreciated in the industries, especially gaming. When paired with technologies like Augmented Reality, it can amount to an immensely useful for everyday use as well, like navigation or calendars. 

While technology can be a necessity to make lives easier, it can also be an engaging and curious tool for education, simulations, training and even tourism. The aim of this project is to get introduced to what could be done with geolocation and augmented reality, while exploring concepts like occlusion.


Augmented Reality


Imagination bred innovation and technologies such as AR has proven to be a beneficial kick that businesses need to capture the attention of their audience. Augmented Reality (AR), a flourishing revolution within the growing technology industry. With its wide range of uses and features, it is often grouped with one of the technologies that transform the entertainment world, the gaming industry, education, and many other industries, including advancing electronics and simulations.

Read more about augmented reality and the "bigger picture" here.

Implementation


For a starter application, I thought about simulating an application similar to Minecraft. This is already an existing application with many more features. This was the base of that application. It was simple enough and worked without complications. Without much thought for the UI, the app was simple enough and was too much fun to not use, as you can see below. 

Testing WorldCraft application

This was to test the accuracy of placing things on the ground through touches and taps on the phone screen, and also being able to walk around. With the exception of collisions and occlusions, the application works as it should, detecting corners and edges.

Evaluation


Of all the "work-able" applications that were part of GlobAR, this was the most fun to test. Creating various random scenes and moving around the furniture, or even placing blocks outside was fun.

Final video project: GlobAR


Wednesday, August 18, 2021

Fun With Racket: Guess My Number

Guess My Number Racket Style

This project was an independent personal coding project (with GUI) undertaken by the author.   You can find the project by clicking the Github icon. ->GitHub

Author's Note


Racket was the first language I learned to code with - unless you count HTML, but let's be honest, nobody ever does. With Information Technology being one of my favourite subjects at school, it was a bit disappointing coding and programming were never part of it.

Read more about an introduction to Racket in my previous post: click here.

Concept



There was this one trick where you think of a number and you'd be shown the cards below asking you if your number was on the particular card. After going through all six cards, your number would be guessed accurately.
Guess My Number Cards

I was initially obsessed with finding out how this works and after I learnt the trick to it, I started applying it everywhere.

The trick behind guessing the numbers are the first numbers on the card - the top left numbers (circled in red above). If the number you're thinking of is on the card, add the circled number of the respective cards, and you'll eventually have your number.

For example, if you're thinking of 11, it appears on cards 1, 2 and 8 (top-left, top-middle, bottom-left). If you add those numbers together, you get the number you thought of: 
1 + 2 + 8 = 11.

This is also a close representation of working with binary numbers. We can represent the six cards as six consecutive zeroes (000000) as the default state. Again using the example of 11, for every card the number appears on, change the 0 to 1, starting from the right.

001011 is what we end up with, which also translates to 11.

Design and Development


While learning to program in Racket, I thought it would be cool to implement it in Racket. I used the same concept of the cards and used a list for the numbers. 

If the number you're thinking of is on the card, append the "card value" to the list. After the six cards, add the values and display the answer. Simple!

Evaluation



Racket GUI: Guess My Number






Tuesday, August 17, 2021

Fun With Racket: Hangman

HangMan in Racket

This project was an independent personal coding project (with GUI) undertaken by the author.   You can find the project by clicking the Github icon. ->GitHub

Author's Note


Read more about an introduction to Racket in my previous post: click here.

Concept


Hangman - an old school favourite. The goal of the game is to simply guess the letters in the word(s) or the word(s) itself. If you guess a wrong letter, the "hanged man" is drawn piece by piece, until the picture is complete. It allows for about ten incorrect guesses, though it depends from version to version.

If you've played my game, iTimeOut, you're no stranger to this game. Although it's played a little differently, it follows the same concept.

Design and Development


Starting with the basic concepts, I mapped out a simple 2-player game in Racket. One person enters the word to guess and the other person guesses. There's even a help page to indicate this.

Hangman start game screen

After entering the word and clicking start, the game begins. Clicking the letter buttons counts a guess. If the letter is in the word, it automatically displays. If not, the image is affected. 

Playing the hangman game

The second person must guess the word before the full image appears. The "image" is just a series of images that play out as you guess incorrect letters. Win or lose, your word will be displayed.

Evaluation



Racket GUI: Guess My Number

A little validation could be added to the game, checking for things like spaces and blank strings. However, the game is supposed to be simple, so the objectives were met.







 
Loading...