A Terminal Reversi Game
This is a Reversi Game that I wrote in my first year of college life. It's a newbie's work, and the code is in a mass, which is lack of comments.
I'm not going to have any modification on this project; I just want to push this to the Internet.
Just fork this if you want to improve this game.
** WARNING ** The code is BUGGY, BAD-STRUCTURED and the Makefile is INCORRECTLY CONFIGURED. DO NOT view this project a normal one, or even forking this project without fixing those issues; instead, study these code as a BAD PROGRAMMING HABIT CASE.
In this game, the black side is displayed in red and the white side is in white. There is no Computer AI; black and white sides should play on a single machine in turns.
Controllers are:
- Arrow Key or HJKL: control the position of cursor
- Space: Put
You need curses library, which is a bulit-in lib in Unix-like OS. Just type `make' to build the game.
An extension of Dev-C++ named PDcurses is available via Dev-C++'s package manager. If you want to build it in Win32, just install pdcurses package in Dev-C++, open the reversi.dev with Dev-C++, and hit "Build."
- Visit this page and download the latest version of pdcurses-XXXXXX.DevPak
- Launch Package Manager, which might be located in [Start] / [All Programs] / [Bloodshed Dev-C++] / [Package Manager]. You can also double click the executable file C:\Dev-Cpp\Packman.exe
- Hit [Install] at the top-left corner of Package Manager window.
- Point to the pdcurses-XXXXXX.DevPak file that you've just downloaded and click "Open" button.
- Click [Next] and [Finish] buttons until wizard closes.
- When the player can't play any step, the game ends immediately. However in the common rule, in this situation, it will become the turn of the opposite player.
--
一個在終端機玩的黑白棋遊戲
這是我在大一寫的黑白棋遊戲,但寫得很雜亂就是了,甚至還沒寫註解(囧)。
這個專案不會有任何的新修訂,我只是想把它放到網路上。
如果你想要改就直接 fork 吧!
警告 這程式有 很多BUG,結構很爛,且 Makefile 還 寫錯。絕對不要 把這個專案當做什麼範本,或直接 fork 卻沒有修正上述的問題。反之,請把這些程式碼當做一個寫程式習慣很爛的案例。
黑棋是顯示成紅色的,白棋就白色。沒有人工智慧程式,黑白兩造必須在同一台機器上輪流玩。
如何控制:
- 方向鍵或 HJKL:移動游標位置
- 空白鍵:放子
你要有 curses 的函式庫,這在 Unix-like 作業系統是內建的。打 make 就可以編譯了。
當然 Dev-C++ 也有名叫 PDcurses 的函式庫可以用,用套件管理器就可以安裝了。如果你要用 Dev-C++ 編譯的話,請先安裝 PDcurses 函式庫,接著開啟 reversi.dev 的專案檔,按下「編譯」就好了。
- 至 這裡 下載最新版本的 pdcurses-XXXXXX.DevPak。
- 開啟 Package Manager,在 [開始] → [所有程式] → [Bloodshed Dev-C++] → [Package Manager] ,或直接開 C:\Dev-Cpp\Packman.exe
- 按下 Package Manager 左上角的 [Install] 按鈕
- 在開啟檔案的對話方塊中,選擇剛剛下載的 pdcurses-XXXXXX.DevPak
- 一直按 Next 和 Finish 就裝好了。
- 當一方無法下子的時候,整個遊戲會直接結束到計算分數的地方。但事實上在一般的規則裡,應該是輪到對方下子。