Skip to content

Commit 6b263eb

Browse files
committed
Added Teensy!
Cleaned up multiple warnings.
1 parent c1c5a4c commit 6b263eb

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

MicroChess.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ enum state_t : uint8_t {
208208
#include "game.h"
209209
#include "conv.h"
210210

211+
// Add for non-AVR builds
212+
#ifndef pgm_get_far_address
213+
#define pgm_get_far_address(x) ((uintptr_t)(&(x)))
214+
#endif
211215

212216
////////////////////////////////////////////////////////////////////////////////////////
213217
// A structure to represent an opening move or sequences of moves
@@ -309,4 +313,4 @@ extern index_t add_rook_moves(piece_gen_t &gen);
309313
extern index_t add_queen_moves(piece_gen_t &gen);
310314
extern index_t add_king_moves(piece_gen_t &gen);
311315

312-
#endif // MICROCHESS_INCL
316+
#endif // MICROCHESS_INCL

MicroChess.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ long make_move(piece_gen_t & gen)
415415

416416
// Control the percentage of moves that the engine makes a mistake on
417417
if (0 != game.options.mistakes) {
418-
if (random(100) <= game.options.mistakes) {
418+
if (random(100) <= (unsigned) game.options.mistakes) {
419419
gen.move.value -= gen.whites_turn ? +5000 : -5000;
420420
}
421421
}
@@ -441,7 +441,7 @@ long make_move(piece_gen_t & gen)
441441
direct_write(DEBUG2_PIN, LOW);
442442
}
443443

444-
if ((0 == game.options.randskip) || (random(100) > game.options.randskip)) {
444+
if ((0 == game.options.randskip) || (random(100) > (unsigned) game.options.randskip)) {
445445
// Explore The Future! (plies)
446446
game.ply++;
447447
game.turn = !game.turn;
@@ -1130,6 +1130,9 @@ void show_game_options() {
11301130
// Set all of the options for the game
11311131
void set_game_options()
11321132
{
1133+
game.options.white_human = false;
1134+
game.options.black_human = false;
1135+
11331136
// Set game.options.profiling to True to disable output and profile the engine
11341137
game.options.profiling = False;
11351138
// game.options.profiling = True;
@@ -1239,7 +1242,7 @@ void set_game_options()
12391242
// Display the statistics for the game and start another game.
12401243
void setup()
12411244
{
1242-
#if not ARDUINO_AVR_PROMICRO
1245+
#if not ARDUINO_AVR_PROMICRO && not TEENSYDUINO
12431246
// The baud rate we will be using
12441247
#if not ESP32
12451248
static long constexpr baud_rate = 1000000;

chessutil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ piece_gen_t::piece_gen_t(move_t &m, move_t &wb, move_t &bb, generator_t *cb, Boo
5353
}
5454

5555

56-
void inline piece_gen_t::init(board_t const &board, game_t const &game) {
56+
void /*inline*/ piece_gen_t::init(board_t const &board, game_t const &game) {
5757
piece = board.get(move.from);
5858
type = getType(piece);
5959
side = getSide(piece);

led_strip.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <stdint.h>
1111
#include "MicroChess.h"
1212

13-
#if not ARDUINO_ARCH_RENESAS && not ESP32 && not ARDUINO_AVR_PROMICRO
13+
#if not ARDUINO_ARCH_RENESAS && not ESP32 && not ARDUINO_AVR_PROMICRO && not TEENSYDUINO
1414
#include <FastLED.h>
1515

1616
FASTLED_USING_NAMESPACE
@@ -95,4 +95,4 @@ void set_led_strip(index_t const flash /* = -1 */)
9595
void init_led_strip() { }
9696
void set_led_strip(index_t const /* flash = -1 */) { }
9797

98-
#endif // #if not ARDUINO_ARCH_RENESAS && not ESP32
98+
#endif // #if not ARDUINO_ARCH_RENESAS && not ESP32 && not ARDUINO_AVR_PROMICRO && not TEENSYDUINO

0 commit comments

Comments
 (0)