avatar
看来方差点被打死# Chemistry - 化学
t*o
1
先用旧护照的号码约了时间,但是那个护照快过期了,dc换发了一个。号码不一样。允
许打电话修改号码吗?
avatar
c*7
2
请问哪里有,请告诉我吧,有包子奖励,谢谢啦。另外本版我是新人,如果没有看到我
来回包子,也请站内邮件,谢谢啦:)
avatar
c*9
3
http://homepages.cwi.nl/~tromp/go/Go.hs
{-# LANGUAGE ScopedTypeVariables #-}
module Go where
import Data.Ix
import Data.List
import Data.Array
import Control.Monad
import Control.Monad.State
data Player = Black | White deriving (Eq, Enum, Show)
data Color = Empty | Stone Player deriving (Eq, Show)
newtype Position p = Position (Array p Color) deriving (Eq)
color :: (Point p) => Position p -> p -> Color
color (Position pos) p = pos!p
class (Show p, Ix p) => Point p where
pointBounds :: (p,p)
neighbours :: p -> [p]
showpos :: Position p -> String
string :: (Point p) => Position p -> p -> [p]
string pos point = join (expand [[point],[]]) where
expand [email protected](curr:prev:_) = if (null next) then l else expand (next:l) where
next = nub [nbr | nbr >=neighbours, color pos nbr == color pos
point] \ prev
liberties :: (Point p) => Position p -> [p] -> [p]
liberties pos group = [nbr | nbr >=neighbours, color pos nbr ==
Empty]
clear :: (Point p) => Position p -> [p] -> Position p
clear [email protected](Position ar) points = Position (ar // zip captured (repeat Empty)
) where
captured = join [str | ptpos str)]
move :: (Point p) => Player -> p -> Position p -> Position p
move player point (Position ar) = pos3 where
pos1 = Position (ar // [(point,Stone player)])
opponent = [nbr|nbrplayer]
pos2 = clear pos1 opponent
pos3 = clear pos2 [point]
data (Point p) => Turn p = Pass | Move p deriving (Eq, Show)
type Game p = [Turn p]
data GoError = NoPoint | Occupied | Superko Int deriving (Eq, Show) -- cycle
length
type TurnOut = Either GoError String
type GameState p = State [Position p] -- remember list of previous positions
play :: (Point p) => Player -> Turn p -> GameState p TurnOut
play player Pass = do
[email protected](pos:_) put (pos:past)
return $ Right $ show (length past) ++ ". " ++ show player ++ " passn" ++
gameover past
play player (Move point) = if not (inRange pointBounds point) then return (
Left NoPoint) else do
[email protected](pos:_) if color pos point /= Empty then return (Left Occupied) else let
pos' = move player point pos
in case elemIndex pos' past of
Just i -> return $ Left $ Superko (1+i)
Nothing -> do
put (pos':past)
return $ Right $ show (length past) ++ ". " ++ show player++" "++
show point++"nn"++showpos pos'
gameover :: (Point p) => [Position p] -> String
gameover (pos:pos':_) | pos == pos' = "nGame Over. Black: " ++ show bscore +
+ " White: " ++ show wscore ++ ". " ++ winner ++ "n" where
[bscore, wscore] = map (score pos) [Black, White]
winner = case compare bscore wscore of
LT -> "White wins."
EQ -> "It's a tie."
GT -> "Black wins."
gameover _ = ""
score :: (Point p) => Position p -> Player -> Int
score pos player = length . filter (== (Just (Stone player))) . elems .
ownermap $ pos
allpoints :: (Point p) => [p]
allpoints = range pointBounds
ownermap :: (Point p) => Position p -> Array p (Maybe Color)
ownermap [email protected](Position ar) = foldr findowner (fmap Just ar) allpoints where
findowner pt ar = if ar!pt /= Just Empty then ar else let
empties = string pos pt
owners = nub [c|[email protected](Stone p)>=neighbours>>=return.color pos]
owner = case owners of [color] -> Just color; otherwise -> Nothing
in ar // zip empties (repeat owner)
playgame :: (Point p) => Game p -> GameState p [TurnOut]
playgame game = sequence $ zipWith play (cycle [Black,White]) game
showgame :: forall p. (Point p) => Game p -> IO ()
showgame game = do
let startpos = emptypos
putStrLn $ showpos startpos
mapM_ (putStrLn . (either (error.show) id)) $ evalState (playgame game) [
startpos]
emptypos :: (Point p) => Position p
emptypos = Position (listArray pointBounds (repeat Empty))
class (Ord c, Bounded c, Enum c, Ix c, Show c) => Coord c
data (Coord x, Coord y) => Point2D x y = Point2D x y deriving (Eq,Ord,Ix)
instance (Coord x, Coord y) => Show (Point2D x y) where
show (Point2D x y) = show x ++ show y
instance (Coord x, Coord y) => Point (Point2D x y) where
neighbours = neighbours2D
pointBounds = (Point2D minBound minBound, Point2D maxBound maxBound)
showpos = showpos2D
neighbours2D :: (Coord x, Coord y) => Point2D x y -> [Point2D x y]
neighbours2D (Point2D x y) = [Point2D x y1 | y1[Point2D x1 y | x1neighbours1D z = [pred z | z/=minBound] ++ [succ z | z/=maxBound]
showpos2D :: forall x y. (Coord x, Coord y) => Position (Point2D x y) ->
String
showpos2D pos = unlines (map showrow (reverse allcoords)) ++ files where
showrow y = show y ++ ' ' : intersperse ' ' [tochar (color pos (Point2D x
y)) | xtochar (Stone Black) = '@'
tochar (Stone White) = 'O'
tochar Empty = '.'
files = " " ++ unwords (map show (allcoords::[x])) ++ "n"
allcoords :: (Bounded c, Enum c) => [c]
allcoords = [minBound..maxBound]
mv :: (Coord x, Coord y) => (Int,Int) -> Turn (Point2D x y)
mv (x,y) = Move (Point2D (toEnum x) (toEnum y))
-- example 9x9 game
newtype XCoord = XCoord Int deriving (Eq,Ord,Ix)
instance Enum XCoord where
fromEnum (XCoord x) = x
toEnum = XCoord
instance Bounded XCoord where
minBound = XCoord 1
maxBound = XCoord 9
instance Show XCoord where show x = [(['A'..'T']\['I'])!!(fromEnum x - 1)]
instance Coord XCoord
newtype YCoord = YCoord Int deriving (Eq,Ord,Ix)
instance Enum YCoord where
fromEnum (YCoord y) = y
toEnum = YCoord
instance Bounded YCoord where
minBound = YCoord 1
maxBound = YCoord 9
instance Show YCoord where
show y = showy " " (show . fromEnum $ y) where
showy leading sy = drop (length sy) leading ++ sy
instance Coord YCoord
game :: Game (Point2D XCoord YCoord)
game = init (map Move allpoints) ++ [Pass, Pass]
main = showgame game
avatar
w*y
4
雇凶花10万人民币,等于这里postdoc三个月工资,而且不能抵税。揍他一顿的话,
几千就够了。所以说人要出名,否则连10万都不值。
avatar
i*t
5
2个护照一起带过去

【在 t*******o 的大作中提到】
: 先用旧护照的号码约了时间,但是那个护照快过期了,dc换发了一个。号码不一样。允
: 许打电话修改号码吗?

avatar
m*a
6
偶有一段革命歌曲联唱伴奏中有这个的主旋律
但是春晚版本的那个是加长版的
还没有找到

【在 c*******7 的大作中提到】
: 请问哪里有,请告诉我吧,有包子奖励,谢谢啦。另外本版我是新人,如果没有看到我
: 来回包子,也请站内邮件,谢谢啦:)

avatar
a*g
7
哦,有趣。

【在 c*******9 的大作中提到】
: http://homepages.cwi.nl/~tromp/go/Go.hs
: {-# LANGUAGE ScopedTypeVariables #-}
: module Go where
: import Data.Ix
: import Data.List
: import Data.Array
: import Control.Monad
: import Control.Monad.State
: data Player = Black | White deriving (Eq, Enum, Show)
: data Color = Empty | Stone Player deriving (Eq, Show)

avatar
c*n
8
你这个因为所以的逻辑很强,

【在 w****y 的大作中提到】
: 雇凶花10万人民币,等于这里postdoc三个月工资,而且不能抵税。揍他一顿的话,
: 几千就够了。所以说人要出名,否则连10万都不值。

avatar
t*o
9
不用事先打电话通知他们了?

【在 i******t 的大作中提到】
: 2个护照一起带过去
avatar
c*7
10
知心哥。帮我。。。
你也知道我先给干啥。哇咔咔

【在 m******a 的大作中提到】
: 偶有一段革命歌曲联唱伴奏中有这个的主旋律
: 但是春晚版本的那个是加长版的
: 还没有找到

avatar
S*o
12
赞语文水平

【在 w****y 的大作中提到】
: 雇凶花10万人民币,等于这里postdoc三个月工资,而且不能抵税。揍他一顿的话,
: 几千就够了。所以说人要出名,否则连10万都不值。

avatar
m*a
13
“你也知道我先给干啥”?
这位国际友人
您说的是哪一国的中文?

【在 c*******7 的大作中提到】
: 知心哥。帮我。。。
: 你也知道我先给干啥。哇咔咔

avatar
c*n
14
俺脚的当叫兽的必要条件之一就是要aggressive

【在 S********o 的大作中提到】
: 赞语文水平
avatar
w*y
15
嘿嘿 娱乐么

【在 c******n 的大作中提到】
: 你这个因为所以的逻辑很强,
avatar
j*5
16
你给postdoc这么多工资?40w RMB一年,合将近6w刀,有些学校AP都拿不到这个数吧

【在 w****y 的大作中提到】
: 雇凶花10万人民币,等于这里postdoc三个月工资,而且不能抵税。揍他一顿的话,
: 几千就够了。所以说人要出名,否则连10万都不值。

avatar
s*x
17

wesley老师那个学校的?
加州的学校给的挺高
我有朋友在加州公立学校,2007年去的58k,每年还涨点,现在已经65k了
他老婆也在隔壁大牛校计算的postdog,也快50k了

【在 j*********5 的大作中提到】
: 你给postdoc这么多工资?40w RMB一年,合将近6w刀,有些学校AP都拿不到这个数吧
avatar
w*y
18
我们这旮旯 4.5 - 5.5w,不差钱的给5.5w。

【在 j*********5 的大作中提到】
: 你给postdoc这么多工资?40w RMB一年,合将近6w刀,有些学校AP都拿不到这个数吧
avatar
j*5
19
够多了,俺们这都不到3.5w

【在 w****y 的大作中提到】
: 我们这旮旯 4.5 - 5.5w,不差钱的给5.5w。
avatar
w*y
20
听说有些地方州立是这样的。AP呢?也低么?

【在 j*********5 的大作中提到】
: 够多了,俺们这都不到3.5w
avatar
j*5
21
拿原来我那个学校化学系,薄厚工资一般3w,最低线2w9,4w算巨高的
AP的start salary是6w

【在 w****y 的大作中提到】
: 听说有些地方州立是这样的。AP呢?也低么?
avatar
m*r
22
很多地方都是这样吧

【在 j*********5 的大作中提到】
: 拿原来我那个学校化学系,薄厚工资一般3w,最低线2w9,4w算巨高的
: AP的start salary是6w

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。