ぱたへね

はてなダイアリーはrustの色分けができないのでこっちに来た

PAIP

PAIP 4.14 The Block World Domain

ブロックを移動させたり積み上げたりする問題。 テーブルに置いてある2個のブロックを積み上げる問題 最初の状態 ('a on table', 'b on table', 'space on a', 'space on b', 'space on table') 実行結果 [('executing', 'move a from table to b')] Aをテー…

PAIP 4.13 The Maze Searching Domain

GPSを使って迷路を解く問題。 昔よく似た問題を解いたような気がしますが、今回の迷路はこちらです。スタートが1で、ゴールが25です。 迷路はlistで表現しています。 maze_data = [(1,2),(2,3),(3,4),(4,9),(9,14),(9,8),(8,7),(7,12),(12,13),(12,11), (11,…

4.12 Monkey and Bananas

の続きです。 天井にぶら下がっているバナナをお猿さんは食べる事ができるでしょうか。ソースはgithubに。 https://github.com/natsutan/PAIP/blob/master/ch4/gps2.py https://github.com/natsutan/PAIP/blob/master/ch4/monky.py実行結果 $ python monky.p…

働くパパのためのThe General Problem Solver

Paradigms of Artificial Intelligence Programming: Case Studies in Common Lispの4章から。4章の一番最初に出てきたプログラムをPythonで実装してみました。元のlispソースはhttp://norvig.com/paip/gps1.lispです。教科書は息子を学校に連れて行くパパで…