Over the weekend, I was able to add a few extra features to the program, including an Intelligence Dampener and support for a Wii Nunchuck. Using Todbot's library, I was able to get reading from each potentiometer, and buttons.
I eventually got sick of the AI winning too often, so I added an Intelligence Dampening Constant (IDC). The AI would only make a possible smart move if a randomly generated number from 1 to 100 was greater the IDC (preset at 10). Otherwise, it would play randomly. It can be changed by tilting the Joystick and pressing a button (different from the one used for playing).
Todbot's library has several functions. The ones that I used were:
nunchuck_init();
-to initiate the nunchuck
nunchuck_setpowerpins();
-to set up the pins (for use with a WiiChuck Adapter)
nunchuck_get_data();
-to request, decode, and separate data from the controller.
nunchuck_joyx();
nunchuck_joyy();
nunchuck_cbutton();
nunchuck_zbutton();
-to return data from the controller.
While I would have to agree that I do not understand some of the code, I would prefer to go through this more complicated process, than to disassemble the controller and wire it directly to the Arduino. I'm not even sure if I can even find the right screwdriver.
Possibilities for a controller (in order of preference and other comments):
1) Nunchuck with WiiChuck adapter and Todbot's library (Cool method)
2) A non invasive method of rewiring Nunchuck to Arduino (not sure if it can be done)
3) Making our own controller (unsure about design)
4) A invasive method of rewiring Nunchuck to Arduino (destructive)
Sources:
WiiChuck:
http://todbot.com/blog/2008/02/18/wiichuck-wii-nunchuck-adapter-available/
I eventually got sick of the AI winning too often, so I added an Intelligence Dampening Constant (IDC). The AI would only make a possible smart move if a randomly generated number from 1 to 100 was greater the IDC (preset at 10). Otherwise, it would play randomly. It can be changed by tilting the Joystick and pressing a button (different from the one used for playing).
Todbot's library has several functions. The ones that I used were:
nunchuck_init();
-to initiate the nunchuck
nunchuck_setpowerpins();
-to set up the pins (for use with a WiiChuck Adapter)
nunchuck_get_data();
-to request, decode, and separate data from the controller.
nunchuck_joyx();
nunchuck_joyy();
nunchuck_cbutton();
nunchuck_zbutton();
-to return data from the controller.
While I would have to agree that I do not understand some of the code, I would prefer to go through this more complicated process, than to disassemble the controller and wire it directly to the Arduino. I'm not even sure if I can even find the right screwdriver.
Possibilities for a controller (in order of preference and other comments):
1) Nunchuck with WiiChuck adapter and Todbot's library (Cool method)
2) A non invasive method of rewiring Nunchuck to Arduino (not sure if it can be done)
3) Making our own controller (unsure about design)
4) A invasive method of rewiring Nunchuck to Arduino (destructive)
Sources:
WiiChuck:
http://todbot.com/blog/2008/02/18/wiichuck-wii-nunchuck-adapter-available/