Giter Site home page Giter Site logo

gyul-hap's Introduction

This program solves Gyul! Hap! puzzles as seen on the Korean game show The Genius.

A Gyul! Hap! puzzle consists of a grid of pictures, where each picture is defined by a colour, shape, and background colour. A "Hap" is a set of 3 pictures where each property (colour, shape, background colour) is either all the same or all different between the three pictures. For example, a red circle on a white background, a blue circle on a white background, and a yellow circle on a white background form a "Hap" because the colours are all different, and the shapes and backgrounds are all the same. This program identifies all of the Haps on a grid, given descriptions of the pictures on the grid.

You will need a text file containing information about the Gyul! Hap! board you want to solve. Each line of the text file should contain the colour, shape, and background colour, in that order and separated by spaces, for a picture on your board. The information for each picture on the board should be on a different line.

You can see how your file should be formatted by looking at the "exampleInput.txt" file.

To run the program from a command prompt, navigate to your directory containing the "GyulHap.hs" file, "solve.sh" file, and your input file, and execute the following command:

./solve.sh exampleInput.txt

Of course, you should replace "exampleInput.txt" with the name of your input file.

Input file short-forms

You can type up input files more quickly using short-forms! See "exampleShortInput.txt" for an example of how to format an input file with short-forms.

Here is a legend of the short-forms for each property:

Colours

  • Red - R
  • Blue - B
  • Yellow - Y
  • Purple - P
  • Green - G
  • Orange - O

Shapes

  • Circle - C
  • Square - Sq
  • Triangle - T
  • Sun - S
  • Moon - M
  • Star - St

Backgrounds

  • Black - Bk
  • Grey - Gy
  • White - W

gyul-hap's People

Contributors

bmaclach avatar

Stargazers

Aaron Kirtland avatar

Watchers

James Cloos avatar  avatar

gyul-hap's Issues

Handle invalid input

The program should handle the following cases of invalid formatting in the input file without breaking:

  • Empty lines
  • Fewer than three pictures on the board
  • Any text that does not correspond to a supported colour, shape, or background colour

Allow for short forms in input files

It's tedious to type out all of the properties for each picture on a board. To help make this process quicker, input files should be allowed to contain short forms for each property.

For example, instead of having to type "Red Circle Black", a user should be able to just type "RCB".

Might run into trouble with this when multiple options for the same property begin with the same letter (i.e. the shapes "Sun" and "Star").

Simplify the command for running the program

The command required to run the program is unnecessarily complicated. It should be a simple command with a single argument (the input file). This can be accomplished with a makefile, or potentially some other method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.