CodeGrade at SIGCSE 2022

Join CodeGrade's Raffle
and win an iPad!

How to join CodeGrade's Raffle

We hope you are enjoying SIGCSE 2022 as much as we do, thank you for stopping by our booth and joining our raffle! Follow the steps below to enter the raffle to win an iPad! The winner will be announced during the CodeGrade Supporter Session on Saturday, March 5th, 9:20am - 10:35am Room 551 A/B (RICC) and on our Twitter!
Start the Coding Puzzle!
Register for our Raffle Assignment

Go to our special Raffle CodeGrade Assignment and sign up for a new CodeGrade account to start the coding puzzle!

Solve the coding puzzle (optional!)

Click on the Raffle assignment and make a new submission using the Editor to solve our coding puzzle! Do you have what it takes to get full marks?

Win an iPad!

Everyone that registers for the Raffle Assignment will automatically enroll in our raffle to win an iPad!

The Coding Puzzle: Dunglish

A confused Dutchman trying to speak English could say “I am in the war”, even though there is no hostile activity going on. The confusion here is that the English sentence “I am confused” is translated in Dutch as “Ik ben in de war”, which is phonetically (“sounding”) quite close to the first sentence. Such confusion leads to much enjoyment, but can complicate matters a bit.

As a Dutch company and computer programmers we want to automate the process of translating. However, our dictionary unfortunately has some Dunglish translations in there. Luckily, for whatever reason, the creators of the dictionary have indicated for every word if it is a correct translation or an incorrect "Dunglish" one.

The goal of the exercise is to display, for a given sentence, how many ways we can translate it, and if there is only one translation output for that translation.

Each time your program runs it has to try to translate one sentence. The first line of input is the sentence you have to translate. This sentence will consist of between 1 and 20 words separated by spaces, each word will be between 1 and 20 lowercase letters.

After this first line you will receive the dictionary. This will consist of multiple lines, each line being an entry in the dictionary. Each entry contains three words separated by spaces, the first word is the Dutch word that the translation is for, the second word is the English translation, the third and final word is either "english" or "dunglish" depending on if this entry is a correct translation, or a Dunglish one.

It is guaranteed that each word of the sentence that should be translated will have at least one translation, and no more than 8.

The expected output of your program is depended on the amount of possible translations. If there is only one possible translation you should output that translation, followed by either "english" if it is a correct English translation according to the given dictionary or "dunglish" if it is a Dunglish translation.

If you can translate the given sentence in multiple ways you should output the amount of possible translations, and the amount of which are "english".

Example 1:
goedendag sigcse
goedendag hello english
sigcse sigcse english

hello sigcse

This is a simple example. As every word can only be translated one way it is clear that there is one translation only. As every translation is correct it is also clear that the resulting translation is English.

Example 2:
als mollen mollen mollen mollen mollen mollen
als when english
mollen moles english
mollen destroy english
mollen mills dunglish

729 total
64 english

There are multiple translations for one of the words in the sentence, this means that we will always be able to create multiple translations. So our objective is to calculate the amount of possible translations. The amount of total translations is easily calculated by multiplying the amount of possible translations for each word. So in our case that is 1 * 3 * 3 * 3 * 3 * 3 * 3 = 3^6 = 729. To get the correct translations we do the same thing, but now we multiply the amount of possible correct translations: 1 * 2 * 2 * 2 * 2 * 2 * 2 = 2^6 = 64.

Example 3:
de zuigers zijn buiten werking
zijn are english
banaan banana english
de the english
zuigers suckers dunglish
buiten out english
werking working dunglish

the suckers are out working

There is exactly one translation for every word in the sentence, this means that we are only able to create one translation. So our objective is to find that translation. As we see that one of the translations is Dunglish we know that our resulting translation is also Dunglish.

Challenge from Northwestern European Regional Contest 2017.

A template to do input handling and output printing is already available within the CodeGrade editor, all you have to do for this puzzle is create the short algorithm to get to the correct output. You have to fill in the #TODO sections in the count_possible_translations and print_any_translation functions. Press the Hand In button to check your solution as many times as you want, press the Edit button to go back to editing!
Start the Coding Puzzle!

Meet us!

We'd love to get to know you better at SIGCSE 2022 in Providence! Here's our SIGCSE agenda:

- Join us for refreshments on Friday 4th March, 5pm to 7pm at the Trinity Brewhouse, 186 Fountain Street.

- Supporter Session Presentation: Scaling and automating an Online Master’s Degree in Data Science at Eastern University, Saturday, March 5th, 9:20am - 10:35am Room 551 A/B (RICC).

Grow your coding classroom
without compromise.