Giter Site home page Giter Site logo

justin-marian / magic-temple Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 40 KB

Simple program that solves string problems: large number additions, cipher encodings and "2-grams"".

License: MIT License

Makefile 2.52% Shell 11.91% C 85.58%
c encryption parser string-manipulation caesar-cipher vigenere-cipher

magic-temple's Introduction

Magic Temple

Overview

The Magic Temple project consists of a series of string problems based on:

  • navigating a character through a mystical temple
  • encrypting cryptographic operations
  • predicting word sequences.

Magical Words

Navigating through a temple represented as a matrix, with a magic code dictating the path. The code consists of magical words of three types, each indicating a direction to move in the matrix:

  • 'a': Words starting with 'a', indicating a single step based on the largest digit.
  • 'b': Words starting with 'b', with movement based on properties of palindromes and prime numbers.
  • 'c': Words starting with 'c', where the movement is determined by the sum of certain digits and its remainder when divided by 4.

Strange Voice

Upon exiting the maze, you encounter encrypted messages from a strange voice. This problem involves deciphering these messages using Caesar and Vigenère ciphers and performing addition on large numbers.

  • Caesar: shifts each letter and digit in the plaintext by a fixed number determined by a key, wrapping around the alphabet and number set.
  • Vigenère: applies a series of Caesar shifts varying per letter, based on the corresponding letter's position in the keyword.
  • Addition: sums two large numbers represented as strings, digit by digit, from right to left, accounting for any carry-over.

Help Prediction

The final task is to complete an algorithm that predicts the next words in a sentence based on the frequency of 2-grams in a given text. For the word prediction algorithm, you'll be enhancing a text analysis tool that computes the frequency of 2-grams—pairs of consecutive words, assists in predicting word sequences.

This task involves reading and processing text to identify these word pairs, calculating how often each pair occurs, and using that information to predict what might come next in a sentence. This feature is case-sensitive and disregards punctuation, focusing solely on the words as they appear in the text.

Build the Project

  1. Navigate to the build directory.
  2. Run the make command to build the executable.

The Makefile provided will compile the source files and link them with the necessary libraries.

    cd ./build
    make

Run the Project

After building the project, you can run the program with the shell script temple_run.sh to execute the program. This script sets up the necessary environment and arguments for the program to run the test suite.

    ./temple_run.sh
    ..........................MAGIC WORDS..............................
    Test 0.......................................................passed
    Test 1.......................................................passed
    Test 2.......................................................passed
    Test 3.......................................................passed
    Test 4.......................................................passed
    
    ............................MAGIC CIPHER...........................
    ...............................CAESAR..............................
    Test 0.......................................................passed
    Test 1.......................................................passed
    Test 2.......................................................passed
    Test 3.......................................................passed
    Test 4.......................................................passed
    ..............................VIGENERE.............................
    Test 0.......................................................passed
    Test 1.......................................................passed
    Test 2.......................................................passed
    Test 3.......................................................passed
    Test 4.......................................................passed
    ..............................ADDITION.............................
    Test 0.......................................................passed
    Test 1.......................................................passed
    Test 2.......................................................passed
    Test 3.......................................................passed
    Test 4.......................................................passed

    .............................TWO GRAMS.............................
    Test 0.......................................................passed
    Test 1.......................................................passed
    Test 2.......................................................passed
    Test 3.......................................................passed
    Test 4.......................................................passed

magic-temple's People

Contributors

justin-marian avatar

Watchers

 avatar

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.