Congkak is a South-East Asian board game. There are two sets of seven holes plus an additional big hole at the end of each side called house. Players start by scooping balls from one of the hole from their side and distributing one ball at each consecutive hole except for the opponent’s house hole, in a clockwise manner. Players with the most number of balls in their house hole wins.
This is the sourcecode for my congkak robot, a robot that plays congkak.
The robot is based of Lego Mindstorms EV3 booted in an EV3dev distribution of linux and coded in Python.
- Boot up the EV3 brick.
- Navigate to File Browser
- Click robot_congkak.py
- If there are issues, insert a keyboard, open the command line and press CTRL-C to quit the program
-
Press CTRL-ALT-F6 to open the terminal
-
To run the python file
python congkak_robot.py
3. To turn it into an executable file
Add this line on top of your code
#! /usr/bin/env python
Then, in the command line, execute
chmod u+x congkak_robot.py
- Press CTRL-ALT-F1 to exit terminal
It is a human vs machine game so there will be alternate turns. The game starts with the human's turn.
-
The game starts off with the robot calibrating to the right.
-
Press the touch sensor and start picking the balls from one of the hole from your side and distribute. The robot detects your hand and does the calculation on the background.
-
If you end up in your 'home' hole, press the touch sensor and to begin your next turn.
-
If you die, press the touch sensor and the robot will starts its turn.
-
When the robot's turn ended, press the touch sensor to begin your next turn.
-
The cycle continues until the game ends.
#Troubleshooting Sometimes the motors do not run. For some reasons, just run ev3_motor.py once and then run the file you wanted. It should work after that.
#Reference For more information, visit eve3dev.org ev3dev.org