stardance has been extended another month! the new deadline is october 31 :)

You are browsing as a guest. Sign up (or log in) to start making projects!

pigpy

  • 2 Devlogs
  • 15 Total hours

A python document that you can run pigpython (pigpython) in.
pigpy is essentially python but with all words translated into pig latin.

Open comments for this post

8h 37m 6s logged

evlogday 2

devlog 2 in piglatin

I haven’t posted a devlog in over 8 hours of work because I’ve been working on pretty much the same function for ages!! I think I’d better just bite the bullet and write about it even when it’s still not finished

What I’m working on:

  • I’m writing a function called combine that will combine the translated English 3D list input (which I talked about in the previous devlog) into a list of all the possible full translations of the pigpy program
  • I will then create a new python file, then write and test each full translation on that document by writing one of the elements of the combine output and then executing it as a python file.
  • Most of the opening, writing, and executing (with try:, except:) is complete, I just need to finish writing combine.

One of my many issues:

  • One issue I encountered was that when you multiply a list in python - e.g.: lst = lst * 2 - the added section on the end of the new lst, which is a repeat of the original lst, will actually point to the same memory as the original lst. This is an issue because after multiplying the list, I need the elements to be able to branch off into having different content to make different translation combinations, but that wasn’t working.
    To solve this I had to import copy and use copy.deepcopy() alongside for loops to make sure they would point to different memory locations

Improvements:

  • I have started using a tests.py file (see screenie) to test functions using assert. I’m very new to this, but it does seem quite useful
  • I am in the process of making organisation changes: I am planning on having multiple .py files so that I can write a lot of functions in one of them, then import them into the other to reduce clutter.
    I think it’s so cool that you can import your own files just like regular libraries, though I suppose that’s just what libraries are!

^- This will be especially useful for the combine function, because it is (imo) so long and complex, and I’d like to break it up into smaller functions to make it easier to read, understand, and debug!!

0
0
9
Open comments for this post

6h 19m 20s logged

ollehway umanshway! Pig latin is not a good language…

I’m working on a python program that runs pigpy and outputs the result. I’m not sure if I’m the first to make pigpy as a language, but it’s essentially python where each word is translated into pig latin.

The major flaw:

Now, you may think this program is simple enough since I just have to translate pig latin into english then run it through python, but there’s one major flaw.

English to pig latin translation is a many-to-one function: up to two English words can translate to the same pig latin word. E.g. ‘in’ and ‘win’ both translate to ‘inway’.

Because of this, there’s no way to tell if inway should translate back to in or way. Luckily, in most cases where pig latin translates to two possible words, only one of them makes sense, and is an actual word. Thus I can use this to my advantage when narrowing down possbile translations.

What I’ve made:

  • Separation function that separates pigpy words from the symbols in the user-written code
  • Translation function that translates each separate pigpy word into its possible English versions.
  • Statement that checks possible translations against set of English words and python keywords. Invalid words are eliminated
  • Error message and quitting if a pigpy word has no valid English translations (i.e. pigpy spelling is wrong)
  • Function that calculates how many possible full translation combinations there are based on the remaining valid English translation possibilities

##The screenshot:
The screenshot shows the output of separating and finding translations for a pigpy program before adding the dictionary. After adding the dictionary, the totalPossibilities (for the full translation) reduced by 508 to just 4!

What’s next?

Next is to test each translation combination by running them through python. Hopefully all but one combination are eliminated, and therefore the correct output can be given to the user.

1
0
31

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…