Giving all the letters necessary for the string makes it a bit simple though. Need to remember that or, =, " and # can all be used as comments practically
Think I'll give xnor's a break, oct(True) or oct(False) returns a 3 char string, but there's not enough o's or spaces to get rid of the remaining letters
Python 3 (74)
Python just wasn't the same after being re-educated by Big Brother.
Input:
print(war is peace)
print(freedom is slavery)
print(ignorance is strength)
There are two newlines at the end of lines 1 and 2.
Output:
True
True
True
Note that each True is in its own line.
>>>
True
True
True
Traceback (most recent call last):
File "C:\Users\Abraham\Desktop\t.py", line 3, in <module>
map))and aaeeeeegginnnpprrrrrvwy
NameError: name 'aaeeeeegginnnpprrrrrvwy' is not defined
>>>
This challenge challenges you to write a function that will take as its argument an array that specifies the types of input, an optional prompt, and a verification key; inputs and validates the values; and returns them.
Input types:
b - Boolean values.
c - Characters.
i - Integer values,...
Suppose you have a 2D rectangular grid. Coordinates are integers. Each cell (point) on this grid contains either a black pixel or a white pixel.
Through some procedure (the details are unimportant), you compute a vector datum for each cell. The vector basically points to "where the cell contents want to go". The angle of the vector indicates direction, the magnitude of the vector indicates magnitude of desire, with 1.0 meaning the contents really want to go in the indicated direction, and 0.0 meaning the contents could care less.
There is also a "viscosity factor", E, ranging from 0.0 to 1.0, that applies to all cells. A factor of 0.0 means that cell contents move about freely, entirely driven by their "desire" vectors. A factor of 1.0 means that contents rarely, if ever, move.
Now suppose you're iterating over many timesteps. In each timestep, the algorithm computes the "desire" vectors for all cells, "resolves" (somehow) the ideal way to get contents to the next timestep, and then updates the cells by moving their (black or white) contents into their target cells. Basically, therefore, you're just moving black and white pixels around like the particles of an incompressible fluid.
My question is: What is a cheap, dirty, and (above all) simple-to-program way of "resolving" the destination of each cell at the end of a timestep?
There must be some randomness in the diffusion. That is, the algorithm that resolves how to best update the cells over one timestep should deliberately not seek the global optimum to the problem. There should always be a bit of randomness. Ideally, the randomness would be controllable using a normalized parameter, where 0.0 indicated pure random diffusion (subject to viscosity) and 1.0 indicated pure "desire"-driven flows (subject to viscosity).
It seems to me that there's a dynamic programming solution in there somewhere, but that seems like ridiculous overkill, and I want to code this thing in an hour or two.
@COTO I don't mind the expression. It's just that it's strangely and incredibly annoying to me when people misuse it. ;) (If you could care less, that means you do care!)
No, it's the tendency for the cell contents to remain sedentary. So if it's zero, even the tiniest desire for cell contents to migrate will cause them to migrate. If it's one, only the strongest possible desire will cause any movement in cell contents.
@isaacg The online compiler doesn't seem to like multi-line statements(i.e. instead of it being ignored, it throws a syntax error) But this might finally get more people to try Pyth, which is great :)
@Sp3000 but I can't see how to get rotating to work either. The problem is that the simplest way is to rotate the whole square. They you can just rotate it back easily
Hmm I guess my best idea would probably still be stock library of transparent background rice images then, and when you place them you can check if any pixels overlap, and roll a dice to decide whether to put it there