Contest

Syndicate content 2 

Continuing on from my last post, I am posting my succesful output for the Day 2 Part 1 below.

A full explanation of Day 2 part 1 can be found at: https://adventofcode.com/2018/day/2 and the input can be found

at: https://adventofcode.com/2018/day/2/input

A brief description of this exercise is that you receive a sequence of strings.

You have to count the if any duplicate or triplicate chars exist in the string.  Multiples will exist, but if you find multiple ldupicates / triplicates you will count them once.

At the end of sequence of strings you have to SUM the no. of duplicate / triplicate chars and multiply them together to get a simple check sum value.

I created 2 methods, one to import the data and the second to analyse the strings and populate the duplicate count and triple count properties

Last comment 15 April 2019
0   0 2
76

views

0

rating

I know it's late, but I really love the advent of code theme each year to find some project ideas to go out and code something and push myself.

I had the intentions of completing the AOC 2018 before the new year, but I've got 2 young kids (1yo and 4yo), so most nights I just want to sleep.

I've been looking at this on my half hourly commute each day before and after work.

So whilst doing this, I found not many people had posted what they had done and in previous years.

I'd found this helpful when I've got stuck for ideas, so I thought I would post what I've done (that works) and see how others might of implemented a solution.

A full explanation of Day1 part 1 can be found at: https://adventofcode.com/2018/day/1 and the input can be found

at: https://adventofcode.com/2018/day/1/input

Last comment 4 March 2019
0   0 2
54

views

0

rating

This is (the end) of a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

This is the 25th and last challenge of the 2016 series of Advent of Code.

In this challenge,  you have to send a signal out,  using the assembunny code interpreter that  we had to make in earlier challenges.

There is one extra instruction added to the assembunny language, which outputs a value (out x)

Last comment 27 November 2017
+ 1   0 4
189

views

+ 1

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...


Today, you need to find your way through a maze (again). There are 8 points of interest in the maze, and you have to visit them all, starting with point 0.
You may visit some points more than once, in random order. The challenge is to find the shortest path through the maze while visiting all points.

The maze looks a bit like this :

0   0 2
0

comments

118

views

0

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...
 

Remember the assembunny language we had to code on day 12 (https://community.intersystems.com/post/advent-code-2016-day12-leonardos...)?

There is a new instruction we have to implement which toggles an instruction x lines away (further or back)

0   0 2
0

comments

129

views

0

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...


The goal of today's challenge is to copy data from one disk to another, problem is that the disks are not directly connected. Luckily they are in a huge grid, and you have to find a way to copy the data through adjacents disks, while honoring the disk usage (you cannot copy to a disk where data is already stored).


The input is a df-like disk usage listing.

The first challenge is to calculate a list of disks that can copy data.

These are all viable pairs of disk nodes (A,B) where

+ 1   0 2
0

comments

145

views

+ 1

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...
 

The challenge of day 21 is about scrambling passwords.

There are a few functions you need to implement that will do operations on a string

+ 2   0 1
0

comments

115

views

+ 2

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

We are almost there : after this challenge, only 5 days left till the end of this advent of code (I cannot wait to get my life back !) .

 

The challenge of day 20 is about a list of integer ranges. Some ranges overlap,  but there are also values that are outside any range.

You have to find out what is the lowest integer that is outside any range.
 

More explanation (there is not much more to say) can be found on http://adventofcode.com/2016/day/20, with the link to your puzzle input

+ 1   0 2
0

comments

115

views

+ 1

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

Today's challenge is a variation on the White Elephant gift exchange (https://en.wikipedia.org/wiki/White_elephant_gift_exchange), in this case, by a bunch of Elves where only one can have all gifts.


Each Elf brings a present. They all sit in a circle, numbered starting with position 1. Then, starting with the first Elf, they take turns stealing all the presents from the Elf to their left. An Elf with no presents is removed from the circle and does not take turns.

With 5 elves, the Elf that sits in position 3 gets all the presents

+ 2   0 1
0

comments

123

views

+ 2

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

 

You walk into a room, step on a tile and hear a loud click...

Traps !

The challenge is about avoiding traps.

 

You can recognise if a tile is a trap by following scheme :

The first row is a given : a safe tile is shown as . and a trap is shown as ^
For the next rows, the state of a tile is calculated related to the tiles in the previous row (same position, tile left and tile right).
If the tile is at an edge, the non-existing tile at the previous row outside the edge is considered safe.

This is how you can calculated if a tile is safe or trap while looking at the tiles on the previous row

+ 1   0 1
0

comments

92

views

+ 1

rating

#########
#S| | | #
#-#-#-#-#
# | | | #
#-#-#-#-#
# | | | #
#-#-#-#-#
# | | |  
####### V

<!--break-->

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...


The challenge today is again a-maze-ing (as a wellknown president would say).


The maze has a bunch of doors ( | and - on the drawing), but they can be locked depending on a hash that you need to calculate every step. When you visit a location a second time, the lock on each door can be different from the previous time !


The way to know that a door is locked

+ 1   0 1
0

comments

130

views

+ 1

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

The challenge of day 16 is about generating random data using a modified version of a dragon curve (you can find more info on fractal curves like Dragon here : https://en.wikipedia.org/wiki/Dragon_curve).

First you need to generate data in a loop as follows

0   0 1
0

comments

138

views

0

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction and an index of all articles: go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

The challenge for today consists of capsules that bounce through a maze of spinning discs.
The capsule can fall through a hole of each disc if they hit the disc at position 0,  each disc has a fixed amount of positions that rotate every second.
The distance between the release and the first disc is one second, as is the distance between each consecutive disc as well.
You have to calculate at what precise time you need to drop a capsule so that it will fall through all the discs

0   0 1
0

comments

97

views

0

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

The challenge today is about some basic cryptography : you will have to generate data for a one-time pad (OTP) (see https://en.wikipedia.org/wiki/One-time_pad for more info).

You need to generate keys by taking the MD5 of a pre-arranged salt (your puzzle input), and an increasing integer index starting with 0.

Only those keys are valid which have

0   0 1
0

comments

127

views

0

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

Today, you have to find a path through a maze. To know if a coordinate is a wall or an open space, you will have to do a calculation like this :

 

x*x + 3*x + 2*x*y + y + y*y
Add the office designer's favorite number (your puzzle input).
Find the binary representation of that sum; count the number of bits that are 1.
  - If the number of bits that are 1 is even, it's an open space.
  - If the number of bits that are 1 is odd, it's a wall.

 

The complete description is on http://adventofcode.com/2016/day/13, and it also includes your puzzle input

0   0 1
0

comments

122

views

0

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

Today, you need to make a compiler for the language assembunny.
Luckily, this language has only 4 instructions :

 

cpy x y copies x (either an integer or the value of a register) into register y.
inc x increases the value of register x by one.
dec x decreases the value of register x by one.
jnz x y jumps to an instruction y away (positive means forward; negative means backward), but only if x is not zero.


For example :

cpy 41 a
inc a
inc a
dec a
jnz a 2
dec a

After executing these instructions, the register a would contain 42

Last comment 12 November 2017
+ 1   0 2
146

views

+ 1

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

The challenge today is about microchips and generators. A microchip belongs to one particular generator, and the two can be on the same floor, or in the same elevator. But if a microchip is with another generator on the same floor or elevator, it will get toasted, except if his own generator is also on the same floor/elevator.
The elevator has only room for two items (can be mix of microchips/generators), the elevator stops on each floor for one second, enough for a microchip to get toasted if there is another type of  generator on the same floor/elevator and its own generator is not there

+ 1   0 1
0

comments

171

views

+ 1

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

In today's challenge, you have to execute instructions that control how bots are handling microchips.

The input contain instructions that can be something like this :

Last comment 11 November 2017
+ 2   0 2
138

views

+ 2

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

Today's challenge is about decompressing input that is compressed in an experimental format.
In the format, markers indicate how much time a number of characters need to be repeated.

For example

Last comment 11 November 2017
+ 2   0 2
252

views

+ 2

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : goto to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

The input in today's challenge consists of an encrypted name, a dash, a sectorID, a dash and a checksum between brackets.
A name is real if the checksum is equal to the five most common letters in the encypted name.


For example : 
aaaaa-bbb-z-y-x-123[abxyz] is a real name because the most common 5 leters are a,b,x,y,z (sorted by numer of occurences and alphabetically)

The challenge is to output the sum of the sectorID's for all the real names

Last comment 8 November 2017
+ 3   0 2
177

views

+ 3

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : goto to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

The challenge of day 5 is to calculate a password of 8 characters by finding the MD5 hash of the input and an increasing integer index.
The password is constructed by taking the 6th character of the first 8 hashes that start with 5 zeroes (in hex representation).

For example : if the input would be 'abc', the first hash that has 5 zeroes would be by MD5 hashing abc3231929 : the hex representation is 00 00 01 55 F8 ...
The 6th character is 1 and thus the first character of the password

Last comment 8 November 2017
+ 2   0 2
189

views

+ 2

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : goto to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

In today's challenge, you have to repair the communication with Santa : messages are coming in, but jammed.
By using repetition code (see also https://en.wikipedia.org/wiki/Repetition_code), you can find out what's in the message : by sending the same message a number of times, you can calculate which characters are most frequent on each position and find the most likely message.

For example, with input like :

eedadn
drvtee
eandsr
raavrd
atevrs
tsrnev
sdttsa
rasrtv
nssdts
ntnada
svetve
tesnvt
vntsnd
vrdear
dvrsen
enarar

the most common characters in each column are e, a, s, t, e, r

Last comment 8 November 2017
+ 1   0 2
162

views

+ 1

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : go to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

The challenge of today has nothing to do with real two-factor authentication ! (sorry if you came to this article by searching the real thing)

For the complete explanation of the challenge, go to http://adventofcode.com/2016/day/8.

Your input (http://adventofcode.com/2016/day/8/input) consists of a series of three basic instructions to control the display of a screen.
The goal of the first part of the challenge is to calculate how much pixels will be lit after all instructions are executed.

The three basic instructions are

Last comment 8 November 2017
+ 1   0 2
119

views

+ 1

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : goto to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

Today's challenge on http://adventofcode.com/2016/day/7 is about checking for valid IPv7 addresses with TLS support. (No, it has nothing to do with real ip addresses which are at most ipV6 or real TLS, but just a way to keep you busy coding & hacking!)

The imaginary ipV7 addresses support TLS if they contain an ABBA sequence outside square brackets and no ABBA sequence inside brackets. (ABBA : any 4 character sequence where the first pair are 2 different characters followed by the reverse of that pair).

For example

Last comment 7 November 2017
+ 1   0 2
157

views

+ 1

rating

This is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : goto to article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta... or look at the http://adventofcode.com/ website.

 

In today's challenge, you have to find out how many 'valid' triangles you find on the walls of the Easter Bunny HQ.
(you can find the input on the adventofcode website : http://adventofcode.com/2016/day/3/input)

A sample of the input looks like this :

  810  679   10
  783  255  616
  545  626  626
   84  910  149
  607  425  901
  556  616  883
  938  900  621

A valid triangle is a set of three side lengths where the sum of any two sides is larger than the remaining side

Last comment 3 November 2017
+ 2   0 3
220

views

+ 2

rating

Advent of Code is a series of programming challenges for beginners and experienced Caché programmers.

For an introduction : look  at article https://community.intersystems.com/post/advent-code-2016-day1-no-time-ta...

In this challenge, you need to find a password using instructions to move on a keypad.
Instructions can be U(p), D(own), L(eft) and R(ight).

You start at button 5 on a keypad like

1 2 3
4 5 6
7 8 9

each line of instructions lead to one digit of the password.
Full description can be found at http://adventofcode.com/2016/day/2

For example : ULL leads to '1' (a move outside the keypad can be ignored

+ 3   0 1
0

comments

207

views

+ 3

rating

Advent of Code is a series of 25 small programming challenges, it's an ideal way for beginners to start learning a computer language, and for advanced people to sharpen their programming skills.

There are small and bigger puzzles, which you can solve typically in half an hour to a few hours. (Looking at the leaderboard, the top aces can do them in less than 10 minutes.)

Advent of Code is created by Eric Wastl, you can find all info on https://adventofcode.com/.

To help you get trained for this year's challenges which start at December 1st, we* will try to solve and comment the puzzles from 2016. (we = Bert Sarens and myself)

Each day, you get two puzzles, where the second one is usually a slight variation on the first one, which shows you how your code will cope with requirement changes or other input (in some cases by having to completely rewriting your code !)

+ 6   0 5
0

comments

504

views

+ 6

rating