Skip to content

Commit

Permalink
Ready for release, I think
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffitus committed Apr 5, 2020
1 parent 2877ea9 commit 3a754b5
Show file tree
Hide file tree
Showing 18 changed files with 396 additions and 221 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,15 @@ By Jeffitus

This is a Sudoku game for TI-CE (ez80) calculators.

Written in C using the community libraries and toolchain.
Written in C using the community libraries and toolchain.

Check out the Cemetech topic [here](https://ceme.tech/t16261).

## Building
You can build this using the [CE C toolchain](https://github.com/CE-Programming/toolchain). Follow the instructions there to install, then enter `make` when you are in the \Sudoku-CE\ directory.

## How to play
Use the arrow keys and 2nd to navigate and select options in menus. You can also use clear to quit or go back. In-game, use the arrow keys to move around the grid, the numpad to enter a number in the selected cell, and graph to toggle the pencil mode. If the pencil in the botton right of the screen is filled in blue, pencil mode is activated. The game will automatically check if you have won when the grid is filled.

## Credits
This game was made by Jeffitus, with some help from MateoConLechuga and jacobly on the Cemetech forums. Also, thanks to DrDnar for his ce-fonts repository, where I found the main font used for this game.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Sudoku CE Changelog

## Version 1.0
- First release
- Only basic functionality: puzzle generation, input numbers and pencil marks, reveal solution
8 changes: 6 additions & 2 deletions src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
#define UNDEFINED (1 << 23)
#define PENCIL_MARKS (511 << 14)
#define PENCIL_MARK(n) (1 << (13 + n))
#define SOLUTION_DATA 240
#define SOLUTION(n) ((n & SOLUTION_DATA) >> 4)
/*For cases where want just the value or just the data*/
#define DATA UNDEFINED & PENCIL_MARKS
#define DATA (UNDEFINED & PENCIL_MARKS & SOLUTION_DATA)
#define VALUE 15

#define EASY 40
Expand All @@ -20,4 +22,6 @@
#define BLACK 1
#define WHITE 2

#define ONE_SECOND 32768
#define ONE_SECOND 32768

extern uint24_t puzzle[9][9];
31 changes: 16 additions & 15 deletions src/drawing.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
#include "gfx/gfx.h"
#include "font/myfonts.h"

extern uint24_t puzzle[9][9];
extern uint8_t solution[9][9];

void draw_three_boxes(uint8_t pos) {
uint8_t i;
uint8_t cell_size = (PLAYING_GRID_SIZE - 1) / 9;
Expand Down Expand Up @@ -54,14 +51,15 @@ bool draw_puzzle(void) {
fontlib_SetCursorPosition(j * PLAYING_GRID_SIZE / 9 + j / 3 + 6 + PUZZLE_X, i * PLAYING_GRID_SIZE / 9 + i / 3 + 6 + PUZZLE_Y);
if (!(puzzle[i][j] & UNDEFINED)) {
fontlib_SetForegroundColor(BLACK);
fontlib_DrawUInt(puzzle[i][j], 1);
}
if (puzzle[i][j] & UNDEFINED && ((puzzle[i][j] & VALUE) != 0)) {
fontlib_SetForegroundColor(BLUE);
fontlib_DrawUInt(puzzle[i][j] & VALUE, 1);
}
if (puzzle[i][j] == 128) {
puzzle_filled = false;
if (puzzle[i][j] & UNDEFINED) {
if ((puzzle[i][j] & VALUE) == 0) {
puzzle_filled = false;
} else {
fontlib_SetForegroundColor(BLUE);
fontlib_DrawUInt(puzzle[i][j] & VALUE, 1);
}
}
}
}
Expand Down Expand Up @@ -95,6 +93,9 @@ void draw_timer(uint24_t timer_count) {

seconds = timer_count % 60;

gfx_SetColor(WHITE);
gfx_FillRectangle_NoClip(240, 2, 32, 54);

fontlib_SetCursorPosition(240, 2);
fontlib_DrawUInt(hours, 2);
fontlib_DrawString(":");
Expand All @@ -105,15 +106,15 @@ void draw_timer(uint24_t timer_count) {
fontlib_DrawUInt(seconds, 2);
}

void draw_string_special(char string[]) {
int i;
for (i = 0; i <= strlen(string); i++) {
if (string[i] == 'y') {
void draw_string(char string[]) {
char *s;
for (s = string; *s; ++s) {
if (strchr("gpqy,", *s) != NULL) {
fontlib_ShiftCursorPosition(0, 5);
fontlib_DrawGlyph('y');
fontlib_DrawGlyph(*s);
fontlib_ShiftCursorPosition(0, -5);
} else {
fontlib_DrawGlyph(string[i]);
fontlib_DrawGlyph(*s);
}
}
}
6 changes: 3 additions & 3 deletions src/drawing.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ void draw_grid(void);
bool draw_puzzle(void);
void draw_pencils(uint8_t row, uint8_t col);
void draw_timer(uint24_t timer_count);
/* neccessary because the font is modified to be smaller, so any case of 'y' have to be handled specially :/
basically just does fontlib_DrawString but changes cursor position for 'y' <laziness>I will only add 'g' when I need to use it eventually</laziness> */
void draw_string_special(char string[]);
/* Neccessary because the font is modified to be smaller, so any case like 'y' has to be handled specially :/
basically just does fontlib_DrawString but changes cursor position for 'y', etc. Right now only a few characters are implemented. */
void draw_string(char string[]);
Binary file modified src/font/HELVE29.fnt
Binary file not shown.
26 changes: 13 additions & 13 deletions src/font/calvetica.inc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00,
0x03, 0x00, 0x03, 0xF0, 0x3F, 0xF0, 0x3F, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x30, 0x30, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7E, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x18, 0x18, 0x18,
0x30, 0x30, 0x30, 0x60, 0x60, 0x60, 0xC0, 0xC0, 0xC0, 0x00, 0x07, 0xC0, 0x1F, 0xE0, 0x38, 0x60,
Expand Down Expand Up @@ -168,9 +168,9 @@
0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xF8, 0x7F, 0xF8, 0x7F, 0x70, 0x00, 0x60, 0x00, 0xE0,
0x00, 0xC0, 0x01, 0x80, 0x01, 0x80, 0x03, 0x00, 0x07, 0x00, 0x0E, 0x00, 0x0C, 0x00, 0x1C, 0x00,
0x38, 0x00, 0x30, 0x00, 0x70, 0xFC, 0xFF, 0xFC, 0xFF, 0x3C, 0x3C, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xC0, 0xC0, 0x60, 0x60, 0x60, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3C, 0x3C, 0xC0, 0xC0, 0x60, 0x60, 0x60, 0x30,
0x30, 0x30, 0x18, 0x18, 0x18, 0x0C, 0x0C, 0x0C, 0x06, 0x06, 0x06, 0x78, 0x78, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x0E, 0x00, 0x1F,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x78, 0x00, 0x0E, 0x00, 0x1F,
0x80, 0x3B, 0xC0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand All @@ -187,14 +187,14 @@
0x60, 0x30, 0x70, 0x70, 0x38, 0xF0, 0x3F, 0xB0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x07, 0xE0, 0x1F, 0x70, 0x38, 0x30, 0x30, 0x18, 0x60, 0xF8, 0x7F, 0xF8,
0x7F, 0x00, 0x60, 0x00, 0x30, 0x38, 0x38, 0xF0, 0x1F, 0xC0, 0x07, 0x1C, 0x3C, 0x30, 0x30, 0x30,
0xFC, 0xFC, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x0F, 0xF0, 0x3F, 0x70, 0x38, 0x30, 0x70, 0x30, 0x60,
0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x70, 0x70, 0x38, 0xF0, 0x3F, 0xB0, 0x0F, 0x00, 0x30,
0xFC, 0xFC, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xB0, 0x0F, 0xF0, 0x3F,
0x70, 0x38, 0x30, 0x70, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x70, 0x70, 0x38,
0xF0, 0x3F, 0xB0, 0x0F, 0x30, 0x00, 0x30, 0x00, 0x60, 0x30, 0xE0, 0x3F, 0x80, 0x0F, 0x00, 0x30,
0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x37, 0xC0, 0x3F, 0xC0, 0x38, 0x60, 0x30,
0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30,
0x30, 0x30, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0xE0, 0x30, 0xC0, 0x31,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0xF0, 0xC0, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0xE0, 0x30, 0xC0, 0x31,
0x80, 0x33, 0x00, 0x37, 0x00, 0x3E, 0x00, 0x3F, 0x80, 0x3B, 0x80, 0x31, 0xC0, 0x31, 0xE0, 0x30,
0x60, 0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand All @@ -204,11 +204,11 @@
0x00, 0x00, 0x00, 0x37, 0xC0, 0x3F, 0xC0, 0x38, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30,
0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0xF0, 0x3F, 0x70, 0x38, 0x38, 0x70, 0x18, 0x60, 0x18, 0x60,
0x18, 0x60, 0x18, 0x60, 0x38, 0x70, 0x70, 0x38, 0xF0, 0x3F, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x37, 0xF0, 0x3F, 0x70, 0x38, 0x38, 0x30, 0x18, 0x30,
0x18, 0x30, 0x18, 0x30, 0x18, 0x30, 0x38, 0x30, 0x70, 0x38, 0xF0, 0x3F, 0xC0, 0x37, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x0F, 0xF0, 0x3F, 0x70, 0x38, 0x30, 0x70,
0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x70, 0x70, 0x38, 0xF0, 0x3F, 0xB0, 0x0F,
0x18, 0x60, 0x18, 0x60, 0x38, 0x70, 0x70, 0x38, 0xF0, 0x3F, 0xC0, 0x0F, 0xC0, 0x37, 0xF0, 0x3F,
0x70, 0x38, 0x38, 0x30, 0x18, 0x30, 0x18, 0x30, 0x18, 0x30, 0x18, 0x30, 0x38, 0x30, 0x70, 0x38,
0xF0, 0x3F, 0xC0, 0x37, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0xB0, 0x0F,
0xF0, 0x3F, 0x70, 0x38, 0x30, 0x70, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x70,
0x70, 0x38, 0xF0, 0x3F, 0xB0, 0x0F, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x37, 0x3C, 0x38, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xC0, 0x3F, 0xC0,
0x70, 0x00, 0x60, 0x00, 0x78, 0x80, 0x3F, 0xC0, 0x0F, 0xE0, 0x01, 0x60, 0x00, 0xE0, 0x60, 0xC0,
Expand Down
Loading

0 comments on commit 3a754b5

Please sign in to comment.