summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-01-22Removed unused command from help outputRobby Zambito
2022-01-22Print the board when the user is prompted.Robby Zambito
Also deleted some dead code.
2022-01-22Added diagonal movesRobby Zambito
2022-01-22Fixed spelling errorRobby Zambito
2022-01-22Change how move is appliedRobby Zambito
Use one loop for walking away from the move in each direction. Before there was one loop for each direction, one after another. The other way is probably slightly more efficient, but this seems quite a bit more readable. Also started working on applying the move diagonally, since both reversi and othello seem to allow diagonal moves.
2022-01-21Remove blank lineRobby Zambito
2022-01-21Added a strategyRobby Zambito
Added strategy which will try to minimize the potential flips for the opponents next turn.
2022-01-21Added Scheme procedure to easily get the other playerRobby Zambito
2022-01-21Expose print-board to allow Scheme to print the board normallyRobby Zambito
2022-01-21Apply the move to a copy of the boardRobby Zambito
2022-01-21Made apply_move return the number of flipped spaces.Robby Zambito
This will return zero for invalid moves, and non-zero for valid moves. This means we can continue to use the result of this as a boolean. Also created a new Scheme primitive which returns the number of tiles flipped by a given move. Created two strategies. One which picks the move that flips the most tiles in the current turn, and one which flips the least.
2022-01-21Add a strategy which picks a valid move at randomRobby Zambito
2022-01-21Add command line argument to print the final board as a scheme objectRobby Zambito
This could be useful to create a machine learning AI, which uses the final board for training. Also bubble up the final score and present it at the end of the game.
2022-01-21Consolidate redundant .c filesRobby Zambito
* Move print_board function to board.c * Move the move validation functions to move.c
2022-01-21Don't add empty strings to the historyRobby Zambito
2022-01-21Fleshed out Scheme primitivesRobby Zambito
* Moved board specific functions from othello.h to new othello_board.h * Removed unused function pointer for player moves * Added prototypes in headers for SCM functions, including scm_get_current_player, * Made get_winner accept a board and current player. This is useful for predictions to see if some move would make the other player a winner. * get_winner also writes the players scores to provided pointers.
2022-01-21Removed strategy that would only play a hard coded moveRobby Zambito
2022-01-21Removed useless fileRobby Zambito
2022-01-19Fix issue where top and left edge were not properly accounted for.Robby Zambito
2022-01-18Added a slightly more interesting AIguile-playerRobby Zambito
This AI will simply pick the first valid move it finds. This is pretty much the most basic AI that a full game can be played against.
2022-01-18* Made print_board accept a board to print.Robby Zambito
* free_board should not return anything. * is_valid_move and has_valid_moves accept a board. * Implemented primitives for Scheme strategies to get the current player, and to get the board, and the validity of a move. * Removed game logic from is_valid_move. Instead simply apply the move to a temp board, and see if the move worked. * Created a very simple strategy for testing these primitives. It only hardcodes the first move, and then fails since that move is no longer valid.
2022-01-17Successfully read a move from schemeRobby Zambito
Also was able to print the current board from scheme, so we should be able to do basic analysis at least. Should add more primitives for use from scheme.
2022-01-05Added commentRobby Zambito
2022-01-05Make apply_move accept a board as a parameter.Robby Zambito
This was how it originally was, but I changed it to use a global variable instead. I want to be able to use the apply_move function in the is_valid_move implementation, to have all the logic for checking if a move is valid in one place. Moved the apply_move function out of board.c, since it no longer needs a direct reference to the board.
2022-01-05Open strategy files and pass them to the game loopRobby Zambito
Also fixed a bug where we could have gone off the upper bounds of the board.
2021-12-30Pulled lots of things out of game loopRobby Zambito
2021-12-29Do not pass the board or the current playerRobby Zambito
These functions will use the standard get_board and a function for getting the current player.
2021-12-29Started parsing argumentsRobby Zambito
We will use this to load the strategy file for an AI player.
2021-12-29Do not pass board aroundRobby Zambito
Instead use the get_board() function to get a reference to the board.
2021-11-27Use guix include path for cclsRobby Zambito
2021-11-27Assume the board has been initialized alreadyRobby Zambito
2021-11-26Added more required dependenciesRobby Zambito
2021-11-25Added manifest.scmRobby Zambito
Useful for creating reproducible build environments Also bumped guile version to 3.0 Moved stdio.h include above readline includes.
2021-11-25Add empty statements to supress unused waringRobby Zambito
We will use these values eventually.
2021-11-25Add history for readlineRobby Zambito
Also removed unused function
2021-11-21Make board parameter non-constRobby Zambito
2021-11-21Improved on some readability issuesRobby Zambito
Also made the apply_move function a bit more efficient, and return true if the move was valid. This helps because we can simply use the apply_move function for checking the validity of a move, rather than having a seperate function do similar logic. Use readline.h to read input from the user instead of getline. This adds some quality-of-life improvements.
2021-11-21Added function pointer for getting the player move.Robby Zambito
If the player is an AI one, it will point to a function that will return the move from the AI. If the player is a human, it will point to a function that will prompt the user for input.
2021-11-21Added pragma once to othello.hRobby Zambito
2021-11-21Added _GNU_SOURCE to every fileRobby Zambito
We are not aiming for high portability with this program. Anywhere that Guile is available, we should be able to access _GNU_SOURCE extensions.
2021-11-01Added readline dependency.Robby Zambito
Also added a bunch of compiler flags when doing a debug build.
2021-08-31Add check for upper bounds to see if a move is valid.Robby Zambito
This makes sure we don't accidentally overrun the board. Also added a comment as to why we have the if statement in the check_valid_direction macro.
2021-08-31Added comments to function definitions.Robby Zambito
2021-08-31Add GPLv3 and add copyright notice to each file.Robby Zambito
2021-08-31Update help output stylingRobby Zambito
2021-07-26Removing trailing newline from inputRobby Zambito
2021-07-26Made code DRYer by using macro.Robby Zambito
The macro checks for the validity of a move in each direction.
2021-07-26No need to add 1 to the player_number_from_colorRobby Zambito
It already returns 1 for player 1 and 2 for player 2.
2021-07-26Removed commented codeRobby Zambito
2021-07-26Removed commented codeRobby Zambito