This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
KingofGamesYami's profile picture

[Game]CCOthello

Started by KingofGamesYami, 17 March 2015 - 05:36 AM
KingofGamesYami #1
Posted 17 March 2015 - 06:36 AM
Othello, otherwise known as Reversi, is a game I've enjoyed for many years. I decided to create it in CC because, to my knowledge, nobody else has.

Download:

pastebin get rMeh1Kag

Future plans:
  • Some sort of turn indicator (whether it is white or black's turn to move) (added in 1.1
  • Some way of determining if there are no possible moves for a player (Ugh…) (added in 1.1) [Toggle-able in 1.2]
  • (Possibly) scale the gameboard, it's a little small (decided not to)
  • AI (Work In Progress) (Added in 1.2)
  • Fix any bugs people report
  • Suggestions?
Current Features:
  • detects valid/invalid moves
  • autoflips game pieces
  • flipping animations
  • determines winner at end of game
1.1
  • counters
  • turn indicator
  • skips player if no moves can be made
  • shows possible move(s)
1.2
  • Arguments (AI, hideMoves)
  • -AI allows you to play against an AI as black1 -hideMoves allows you to play without the possible moves shown
  • Early end game (neither player can move) now handled properly
1.3
  • monitor support
  • toggle show/hide moves in game (m)
1The AI doesn't work on Mimic. I don't know why, I suspect it's got something to do with os.queueEvent.

Instructions:
The game can be run with two three arguments, AI, hideMoves, and monitor. I will briefly outline what they do here:

AI - this engages the built in AI, which moves for black. The AI is not very advanced, and bases it's selections solely on number of pieces it can capture per move.

hideMoves - by default, the game displays the possible moves. This argument disables the feature, since some may want to play without it.

monitor - will search for a monitor, and if found, redirect to it. It will also attempt to scale the game, if your monitor is large enough.

The game contains 1 keybind: m.

m toggles hiding/showing moves on and off.
Edited on 18 March 2015 - 10:27 PM
Bomb Bloke #2
Posted 17 March 2015 - 09:15 AM
I quite like the use of the pipe for the turning animation.

Another possible feature would be a pair of counters keeping track of who's in the lead. And an AI, of course… a simple one would merely examine every move available and pick that which would immediately net it the most pieces. Such a tactic should be quite beatable, while still being fun to play against.

Regarding board size, stick with term.setTextScale() for monitors, and forget about it for regular displays.
KingofGamesYami #3
Posted 17 March 2015 - 11:35 PM
New Update: 1.1. See OP for details.
KingofGamesYami #4
Posted 17 March 2015 - 11:51 PM
I quite like the use of the pipe for the turning animation.

Another possible feature would be a pair of counters keeping track of who's in the lead. And an AI, of course… a simple one would merely examine every move available and pick that which would immediately net it the most pieces. Such a tactic should be quite beatable, while still being fun to play against.

Regarding board size, stick with term.setTextScale() for monitors, and forget about it for regular displays.

Thanks :)/>

Added counters in 1.1, working on an AI

I think I'll discard board size for now, I'll consider monitor support later.
Geforce Fan #5
Posted 18 March 2015 - 02:53 AM
Would you consider having a 2x size game board option? There's a lot of the screen wasted, and it's easier to see the bigger it is. 2x would be 18x18, and CC's displays are natively 51x19, so this wouldn't even break menu-barred OSes
Edited on 18 March 2015 - 01:53 AM
KingofGamesYami #6
Posted 18 March 2015 - 02:08 PM
Would you consider having a 2x size game board option? There's a lot of the screen wasted, and it's easier to see the bigger it is. 2x would be 18x18, and CC's displays are natively 51x19, so this wouldn't even break menu-barred OSes

Do you mean having more positions, or 4 pixels allocated to each position? The former is easy, I've tried the latter: It didn't work to well.
nitrogenfingers #7
Posted 18 March 2015 - 02:12 PM
I really liked this one. It plays nicely and feels true to the original game. An AI opponent would be great but no real other complaints. Nice work :)/>
KingofGamesYami #8
Posted 18 March 2015 - 03:10 PM
New Update: 1.2! See OP for details.

I really liked this one. It plays nicely and feels true to the original game. An AI opponent would be great but no real other complaints. Nice work :)/>/>

Thanks! I've added an AI opponent now.
TheOddByte #9
Posted 18 March 2015 - 10:16 PM
This game is great! I wish you could toggle to show/hide moves in-game, other than that it's great! :D/>
KingofGamesYami #10
Posted 18 March 2015 - 11:28 PM
New version: 1.3! See OP for details.

This game is great! I wish you could toggle to show/hide moves in-game, other than that it's great! :D/>/>

Thanks :)/>. I've added that functionality in 1.3.