Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4071322
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:44:31+00:00 2026-05-20T16:44:31+00:00

Background Lego produces the X-Large Gray Baseplate , which is a large building plate

  • 0

Background

Lego produces the X-Large Gray Baseplate, which is a large building plate that is 48 studs wide and 48 studs tall, resulting in a total area of 2304 studs. Being a Lego fanatic, I’ve modeled a few mosaic-style designs that can be put onto these baseplates and then perhaps hung on walls or in a display (see: Android, Dream Theater, The Galactic Empire, Pokemon).

The Challenge

My challenge is now to get the lowest cost to purchase these designs. Purchasing 2304 individual 1×1 plates can get expensive. Using BrickLink, essentially an eBay for Lego, I can find data to determine what the cheapest parts are for given colors. For example, a 1×4 plate at $0.10 (or $0.025 per stud) would be cheaper than a 6×6 plate at $2.16 (or $0.06 per stud). We can also determine a list of all possible plates that can be used to assemble an image:

1x1
1x2
1x3
1x4
1x6
1x8
1x10
1x12    
2x2 corner!    
2x2
2x3
2x4
2x6
2x8
2x10
2x12
2x16    
4x4 corner!    
4x4
4x6
4x8
4x10
4x12    
6x6
6x8
6x10
6x12
6x14
6x16
6x24    
8x8
8x11
8x16    
16x16

The Problem

For this problem, let’s assume that we have a list of all plates, their color(s), and a “weight” or cost for each plate. For the sake of simplicity, we can even remove the corner pieces, but that would be an interesting challenge to tackle. How would you find the cheapest components to create the 48×48 image? How would you find the solution that uses the fewest components (not necessarily the cheapest)? If we were to add corner pieces as allowable pieces, how would you account for them?

We can assume we have some master list that is obtained by querying BrickLink, getting the average price for a given brick in a given color, and adding that as an element in the list. So, there would be no black 16×16 plate simply because it is not made or for sale. The 16×16 Bright Green plate, however, would have a value of $3.74, going by the current available average price.

I hope that my write-up of the problem is succint enough. It’s something I’ve been thinking about for a few days now, and I’m curious as to what you guys think. I tagged it as “interview-questions” because it’s challenging, not because I got it through an interview (though I think it’d be a fun question!).

EDIT

Here’s a link to the 2×2 corner piece and to the 4×4 corner piece. The answer doesn’t necessarily need to take into account color, but it should be expandable to cover that scenario. The scenario would be that not all plates are available in all colors, so imagine that we’ve got a array of elements that identify a plate, its color, and the average cost of that plate (an example is below). Thanks to Benjamin for providing a bounty!

1x1|white|.07
1x1|yellow|.04
[...]
1x2|white|.05
1x2|yellow|.04
[...]

This list would NOT have the entry:

8x8|yellow|imaginarydollaramount

This is because an 8×8 yellow plate does not exist. The list itself is trivial and should only be thought about as providing references for the solution; it does not impact the solution itself.

EDIT2

Changed some wording for clarity.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:44:32+00:00Added an answer on May 20, 2026 at 4:44 pm

    Karl’s approach is basically sound, but could use some more details. It will find the optimal cost solution, but will be too slow for certain inputs. Large open areas especially will have too many possibilities to search through naively.

    Anyways, I made a quick implementation in C++ here: http://pastebin.com/S6FpuBMc

    It solves filling in the empty space (periods), with 4 different kinds of bricks:

    0: 1x1 cost = 1000
    1: 1x2 cost = 150
    2: 2x1 cost = 150
    3: 1x3 cost = 250
    4: 3x1 cost = 250
    5: 3x3 cost = 1
    
    ..........       1112222221
    ...#####..       111#####11
    ..#....#..       11#2222#13
    ..####.#..       11####1#13
    ..#....#..       22#1221#13
    ..........       1221122555
    ..##..#...  -->  11##11#555
    ..#.#.#...       11#1#1#555
    ..#..##...       11#11##221
    ..........       1122112211
    ......#..#       122221#11#
    ...####.#.       555####1#0
    ...#..##..       555#22##22
    ...####...       555####444  total cost = 7352
    

    So, the algorithm fills in a given area. It is recursive (DFS):

    FindBestCostToFillInRemainingArea()
    {  
      - find next empty square
      - if no empty square, return 0
      - for each piece type available
        - if it's legal to place the piece with upper-left corner on the empty square
          - place the piece
          - total cost = cost to place this piece + FindBestCostToFillInRemainingArea()
          - remove the piece
      return the cheapest "total cost" found
    }
    

    Once we figure out the cheapest way to fill a sub-area, we’ll cache the result. To very efficiently identify a sub-area, we’ll use a 64-bit integer using Zobrist hashing. Warning: hash collisions may cause incorrect results. Once our routine returns, we can reconstruct the optimal solution based on our cached values.

    Optimizing:
    In the example, 41936 nodes (recursive calls) are explored (searching for empty square top-to-bottom). However, if we search for empty squares left-to-right, ~900,000 nodes are explored.

    For large open areas: I’d suggest finding the most cost-efficient piece and filling in a lot of the open area with that piece as a pre-process step. Another technique is to divide your image into a few regions, and optimize each region separately.

    Good luck! I’ll be unavailable until March 26th, so hopefully I didn’t miss anything!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background I work for a large organization which has thousands of MS Access applications
Background My project is urgent and requires that I iterate a large XML file
Background I have a dimension table that has a single record for each day.
Background, Part 1 I have a form that collects both frequency and duration from
background: I work on an asp.net web application that is on a company intranet.
Background (can skip to question below...) Currently working with a lego Mindstorm robot and
Background: I have a css and a js that is used only by the
Background I have a ror application which is continuously recording and showing on a
Background: My employeer at my non-programming job knows that I am an undergraduate CS
Background: At my company we are developing a bunch applications that are using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.