I’m trying to put together a clock multiplier, and it’s not going great. I’d ideally like to have a clock coming in on one script input, and output a multiple on a trigger out, and avoid manipulating metro, if that’s possible. Show What I’ve come up so far sorta works but is not great:
Things I don’t love about this:
Are there better solutions for this? Apart from TELEXo, which I see has M per-trigger out and also multipliers for that metro, which I assume would line up better. But, I’m curious how to do this in ‘vanilla’ Teletype. Given a grid and an in-bounds y value. Every square in the grid is either sand 0.a. Write a while loop to search row y left-to-right to find the leftmost sand in it. The leftmost sand in a row is the one with the smallest x value. If there is no sand in the row, return the grid unchanged, otherwise do step b. b. We'll call the square where the leftmost sand is found the "found" square. In all cases, set the found square to be empty ( 0), so the sand disappears. If the square below the found square is empty, set it to contain sand ('s' ), in effect moving the sand down.In the example grid below, at row y=0, the leftmost sand is at 2. It cannot move down because a rock is in the way. At row y=1, the leftmost sand is at 3, and it can move down. 2. Crypto (15 points)This problem is similar to the Crypto homework. As a simplification, there will be no uppercase chars in this problem - the source, slug, and char will all contain lowercase chars, or chars like '$' which do not have an upper/lower case. For this problem, there are two slug lists of the same length, and the source list is twice as long as each slug. Compute and return the encrypted form of a char as follows: if the char does not appear in the source list, return the char unchanged. If the char appears in the source list, consider the index where it appears. (a) If that index is a valid index into slug1, return the char at that index in slug1. (b) If the index is invalid (too large) for slug1, reduce the index by the slug1 length, yielding a smaller number. Return the char at that smaller index in slug2. In effect, depending on the index where the char is found in source, either slug1 or slug2 is used. Say we have this len-4 source and 2 len-2 slugs: source = ['a', 'b', 'c', 'd'] slug1 = ['q', 'r'] slug2 = ['x', 'y'] encryption: 'a' -> 'q' 'b' -> 'r' 'c' -> 'x' 'd' -> 'y' 3. String (25 points)The hottest new cryptocurrency is Yottercoin. A Yottercoin address is marked with a 3 at its end. Before that there are always two digits. And before that is a series of zero or more of the three chars, 4, which make up the address to be returned. Find and return the first Yottercoin address in s, or None if there is none. If there is a '.yot' in the string, you can assume there is a valid Yottercoin address in the string.'xx oyot97.yot xx' -> 'oyot' '.itoytoy22.yot33' -> 'toytoy' 'toytoy' -> None 4. Drawing (15 points)Reminder: the canvas draw_line function: canvas.draw_line(x1, y1, x2, y2) - draws a line from x1,y1 to x2,y2 This function takes in parameters 5 like the Quilt homework, with an additional int parameter a.Like the Quilt homework, the drawing should have its upper left pixel at left,top, and extending to cover width,height pixels. Draw a blue rectangle at the outer edge (the draw-rect line of code is provided below). Leave a "margin" area of width a at the left and right sides of the drawing with no lines drawn in it. The parameter n will be an int, 2 or more. Draw a series of n lines from the top edge to the bottom edge. The first line should start at the top edge, next to the left margin area, and end at the bottom edge next to the right margin area. The last line should start at the top next to the right margin, ending at the bottom next to the left margin, with the other lines distributed evenly in between. How computer represent real number in memory?Computers use binary (base 2) number system, as they are made from binary digital components (known as transistors) operating in two states - on and off. In computing, we also use hexadecimal (base 16) or octal (base 8) number systems, as a compact form for representing binary numbers.
How many ways we represent number in computer?There are two main ways to represent numbers: integer and floating point.
|