找回密码
 注册
查看: 1142|回复: 5

有没有text mode下面的五子棋游戏,像emacs里面的

[复制链接]
发表于 2005-4-13 09:36:16 | 显示全部楼层 |阅读模式
有没有text mode下面的五子棋游戏,像emacs里面的gomoku.el
发表于 2005-4-13 11:47:18 | 显示全部楼层
可以模仿 那个  shell的方块
写个嘛
回复

使用道具 举报

 楼主| 发表于 2005-4-13 13:13:20 | 显示全部楼层
想自己写,水平不够。期待高手出现
回复

使用道具 举报

发表于 2005-4-14 16:54:19 | 显示全部楼层
有空的话我来写一个,用ncurses库的可以吗?

“emacs里面的gomoku.el ”,放个抓图出来看看。
回复

使用道具 举报

 楼主| 发表于 2005-4-15 10:19:33 | 显示全部楼层
好啊。我自己也试着写吧。谢谢版主啦

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
回复

使用道具 举报

 楼主| 发表于 2005-4-15 10:22:22 | 显示全部楼层
我想用vim写,才刚刚开始:
[code:1]
" Gomoku Game in VIM
" v0.1 2005-03-13 Jerry Fleming<[email protected]>

" COMMENT
" This game adopts the idea and algorithm of gomoku.el, which may be found
" in standard Emacs distribution. No restriction is made on the squares one
" may move to disable _force win_ in the TRUE Gomoku, because I have no idea
" how one can force win at all. If you guys do, please let me know.

" some vars that you may change to fix your screen
let s:width = 128         " columns of text your screen can display
let s:height = 48         " rows of text your screen can display
let s:player = "X"        " the piece-shape for a play
let s:robot = "0"         " the piece-shape for the robot
let s:grid = "."          " the mark of a square position
let s:gridwidth = 3       " the width of the grid, which should be less than 5;
                          " otherwise you can only see a very small set of grids

" PLAYING
" use h,l,j,k keys to move around as you would normally do in vimming, and press
" space bar where you see you are likely to win




"""
""" IMPORTANT: you should not edit below whithout aware what you are doing
"""

" since we deliberately makes the board four times of the screen, we should turn
" wrap off to see only a _windowed_ central part of the board
set wrap!
" we'd better set whichwrap so as to move freely with h,l,j,k
set ww=h,l,b,s
" the cmdheight might be changed, so we set it back
set ch=1

" initialize the board
let s:count= 0
while s:count < s:gridwidth - 1
  let s:grid = s:grid . " "
  let s:count = s:count + 1
endwhile

let @" = s:grid
let s:count = 0
while s:count < s:width / s:gridwidth
  normal p
  let s:count = s:count + 1
endwhile

let s:count=0
normal yy
while s:count < s:height - 1
  normal p
  let s:count = s:count + 1
endwhile

normal gg
let s:count=0
while s:count < s:height - 1
  let s:i = s:gridwidth - 2
  while s:i > 0
    normal jd$
    let s:i = s:i -1
  endwhile
  normal j
  let s:count = s:count + 1
endwhile

normal gg0

" keymap to move s:gridwidth at a time and make your turn
let @x = s:player
noremap <Space> x"xPh
noremap l e
noremap h ge
" Gary Johnson <[email protected]> contributed the following maps
noremap j :let q=col(".")<CR>$:call search('\S','W')<CR>:exec "normal" q."\|"<CR>:echo ""<CR>
noremap k :let q=col(".")<CR>0:call search('\S','bW')<CR>:exec "normal" q."\|"<CR>:echo ""<CR>
" save game session
noremap s :w! .vimgomoku<CR>
" abort game
noremap q :q!<CR>
" save and exit
noremap x :wq! .vimgomoku<CR>
" read saved session
noremap r ggdG:r .vimgomoku<CR>
" new game
noremap n ggdG:source gomoku.vim<CR>
[/code:1]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2025-7-19 20:48 , Processed in 0.060357 second(s), 17 queries .

© 2001-2025 Discuz! Team. Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表