Python

TheCatt
Site Admin
Posts: 53995
Joined: Thu May 20, 2004 11:15 pm
Location: Cary, NC

Post by TheCatt »

DBs make the world go round
It's not me, it's someone else.
User avatar
Troy
Posts: 7247
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

I'm sure I'll get there eventually. I want recursion to stick so I'm going to explore some and get some repetition down. Did Pascal's triangle and Fib numbers within the triangle via lists during lunch. Probably mess it up by the time I get home.



Edited By Troy on 1455066387
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

If you want a thoroughly fucked up thing, try both the fractional and 0/1 knapsack problems. Very important uses of recursion.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

Also, since this is my bag, good idea to learn the difference between tail recursion (iteration) and true recursion.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
User avatar
Troy
Posts: 7247
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

The week has escalated quickly. I'm "teaching" the program how to play scrabble using a random hand of 7 letters. It whirs up fast when going through and evaluates the permutations. I already have the version working for the human facing game, but scripting the computer to make the best set of choices is something else entirely.

e: the first word I got it to guess on it's own as a "best possible solution" was "haji"... I only know it in the semi-racist context so I had to look it up and figure out what it actually meant




Edited By Troy on 1455692679
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

Hah. I know a former python guru that coded THE optimal solution for scrabble in the English language. Was because his sister used to beat him at it all the time when he was younger.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
TheCatt
Site Admin
Posts: 53995
Joined: Thu May 20, 2004 11:15 pm
Location: Cary, NC

Post by TheCatt »

Troy wrote:The week has escalated quickly. I'm "teaching" the program how to play scrabble using a random hand of 7 letters. It whirs up fast when going through and evaluates the permutations. I already have the version working for the human facing game, but scripting the computer to make the best set of choices is something else entirely.

e: the first word I got it to guess on it's own as a "best possible solution" was "haji"... I only know it in the semi-racist context so I had to look it up and figure out what it actually meant
What structure are you using for your word dictionary?

Is it using a board, or just making words based on simple point values?
It's not me, it's someone else.
User avatar
Troy
Posts: 7247
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

No board yet, just using point values,. The words are in a txt file I load into a list and compare to the permutations.
TheCatt
Site Admin
Posts: 53995
Joined: Thu May 20, 2004 11:15 pm
Location: Cary, NC

Post by TheCatt »

Troy wrote:No board yet, just using point values,. The words are in a txt file I load into a list and compare to the permutations.
You should look at implementing a trie for the word storage. Super-efficient for word games.

I got tired of losing in Scrabble to my wife (she loves word games, I tolerate them, sometimes). She said I could write whatever helper I wanted, so I wrote a simple solver, like you are doing. You could input additional letters (to make plays off letters on the board), but I never made it board aware (double/triple point/word/etc)
It's not me, it's someone else.
User avatar
Troy
Posts: 7247
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

Weak-ass cryptography this week using dictionaries. Teaching the computer to brute force and guess the shift value.
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

Crypto? Bah, Mersenne twister or bust.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
User avatar
Troy
Posts: 7247
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

There are Python meetups a few times a month in downtown SF. Tonight will be my third. They are pretty fucking awesome. One of the Django core devs spoke at the last one about using Channels instead of WSGI - and I understand about 1/2 of the things out of his mouth. Then they did a mini Startup Row thing with judges and Startup guys pitching their companies that were powered with Python. It was pretty cool.

Tonight is a project and tutorial night. I'm not useful to anyone to hack on anything yet, so I mostly do the tutorials. Trying to choose between Virtual Environments or Flask. Both are tempting. Leaning towards Virtual.

Did I mention that these are sponsored and always have free beer and food before hand. It's crazy out here.




Edited By Troy on 1458167756
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

It's crazy out here.

How's that drought going?
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
TheCatt
Site Admin
Posts: 53995
Joined: Thu May 20, 2004 11:15 pm
Location: Cary, NC

Post by TheCatt »

Malcolm wrote:
It's crazy out here.
How's that drought going?
And rent, don't forget rent.

We have some meetups here, but it's nothing like SF.
It's not me, it's someone else.
User avatar
Troy
Posts: 7247
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

Yup - raining almost every week, last week every day, since we got here. Taking partial credit for that.

And the rent on our less than 700 SQFT apt in Noe Valley is 3400 a month. And is a steal. 30m commute to Financial District on the train. Cat found it online and had to convince the rental company to let us see and get it. It had show furniture in it(like a success story for their investors of the renovation) and they didn't want to move it out.

Oh hey and Cat got a job last week! She's going to be a Senior Web Producer. She was a hot item out here with her got-an-actual-working-app-off-the-ground experience. She turned down 4 other offers and the Google recruiters are still sniffing around, but that process takes forever and if she spends any more money on expensive chairs were going to be sitting on them under the bridge. Time to get her back in the workforce.




Edited By Troy on 1458228097
User avatar
Troy
Posts: 7247
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

Solid view over Noe, though.
Image




Edited By Troy on 1458174907
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

She turned down 4 other offers and the Google recruiters are still sniffing around...

Fuck Google.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
User avatar
Troy
Posts: 7247
Joined: Mon Jun 07, 2004 8:00 am

Re: Python

Post by Troy »

Still at it, and progressing.

I got a rasberry PI, with a bare LCD screen, and have written in python all the code(from the controller/model standpoint) I need for an in-house bus stop monitor. The LCD came with an optional touchscreen - which I'm trying to figure out if I want to make work in the program or not. The problem i'm trying to address is that I'm tired of checking my phone every few minutes in the morning to see when the bus will arriving. I'd like it on my wall, auto updating. Maybe even giving me a 5 minute warning when it's time to head down when I indicate the bus I want.

I also have been working on some practice problems from an online course. I wrote a robot vacuum program, and simulation w/ visualizer. Classes for the rooms, robots, functions for them to make movement decisions, etc. Pretty rad. And I've learned a little bit about the wonders of GitHub. https://github.com/TasmanS
User avatar
Troy
Posts: 7247
Joined: Mon Jun 07, 2004 8:00 am

Re: Python

Post by Troy »

Doing optimization and versions of the fabled "Backpack Problem" this week.

Looking at various ways algorithms can pick solutions. As background, they had us solve a problem using brute force to go with our greedy algorithm methods. I brute forced it a little too hard, first time with a Memory error, I backed down to 1-3 combinations out of a set of 200 selections, and it's still locked up the terminal. Need to get on the dynamic programming train.
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Re: Python

Post by Malcolm »

The 0/1 (or discrete) knapsack is a classic dynamic programming problem, any other methodology isn't complete enough. I can dissect every aspect of it in my sleep. The fractional knapsack is much easier.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
Post Reply