12 years agoPut tiles back in player's hand(in_hand = 1) when turn is finished(press enter) master
Kevin Worth [Sun, 18 Apr 2010 09:29:07 +0000 (05:29 -0400)]
Put tiles back in player's hand(in_hand = 1) when turn is finished(press enter)

12 years agoSave state at start of game
Kevin Worth [Sun, 18 Apr 2010 09:10:36 +0000 (05:10 -0400)]
Save state at start of game

12 years agoMove tile 'out of hand' and onto the board area
Kevin Worth [Sat, 17 Apr 2010 12:27:02 +0000 (08:27 -0400)]
Move tile 'out of hand' and onto the board area

12 years agoDraw top tile from deck and put it incurrent player's hand(press 'd')
Kevin Worth [Sat, 17 Apr 2010 11:34:40 +0000 (07:34 -0400)]
Draw top tile from deck and put it incurrent player's hand(press 'd')

12 years agoSeg Fault bug and compiler warning fixes
Kevin Worth [Tue, 13 Apr 2010 06:13:59 +0000 (02:13 -0400)]
Seg Fault bug and compiler warning fixes

12 years agoShow Carl the latest
Kevin Worth [Tue, 13 Apr 2010 05:07:49 +0000 (01:07 -0400)]
Show Carl the latest

Selected groups of tiles get moved from the deck into the next open group on the board. The state can be saved by hitting enter, which passes the turn to the next player. If you make some changes, you can revert them by hitting escape. The board gets checked to see if all groups are either valid runs or sets.

12 years agoClean up whitespace
Kevin Worth [Sun, 28 Mar 2010 17:37:02 +0000 (13:37 -0400)]
Clean up whitespace

12 years agoSave state and Restore state
Kevin Worth [Fri, 12 Mar 2010 00:44:28 +0000 (19:44 -0500)]
Save state and Restore state

12 years agoMake game.current_tile a pointer of type tile_t rather than a simple int.
Kevin Worth [Sat, 8 Aug 2009 17:28:57 +0000 (13:28 -0400)]
Make game.current_tile a pointer of type tile_t rather than a simple int.

     This is much more powerful as the tiles in players' hands can be set
     as the current tile, not just those in the deck.

12 years agoNeatly rearrange tile group after selected.
Kevin Worth [Sat, 18 Jul 2009 15:07:39 +0000 (11:07 -0400)]
Neatly rearrange tile group after selected.
       In this code there are two methods of achieving this
       rearrangement. The first is complicated and likely overkill
       but it keeps the checks for run and set intact. It is
       currently commented out and thus the second method is being
       used. The second method is slicker and cleaner, using pointers
       instead of an excessive number of loops. But it needs to be
       tweaked as the group of pointers is incompatible with the
       current checks for run and set.

12 years agoDraw tiles owned by player in a way which differentiates them from tiles on board
Kevin Worth [Tue, 7 Jul 2009 12:16:06 +0000 (08:16 -0400)]
Draw tiles owned by player in a way which differentiates them from tiles on board

12 years agoHighlight and un-highlight tiles as they are selected and unselected with the click...
Kevin Worth [Sat, 4 Jul 2009 04:48:31 +0000 (00:48 -0400)]
Highlight and un-highlight tiles as they are selected and unselected with the click and drag selection box

  This code works but could stand a once through
  to check for redundancies, dead code, and/or places
  for optimization. Rendering slows down dramatically
  as the selection box gets bigger and more tiles are

12 years agoAllow selection of tile by including any edge of tile and highlight selected files.
Kevin Worth [Fri, 3 Jul 2009 16:44:12 +0000 (12:44 -0400)]
Allow selection of tile by including any edge of tile and highlight selected files.

      A group of tiles can be selected by overlapping
      the selection box and any edge(not including a corner)
      of each tile.

      Highlighting on the fly is currently buggy. Selected tiles
      remain highlighted even once they are no longer within
      the selection box and even after an empty space or other tile
      is clicked.

12 years agoHighlight tile when clicked and/or dragged.
Kevin Worth [Tue, 30 Jun 2009 16:27:21 +0000 (12:27 -0400)]
Highlight tile when clicked and/or dragged.

  New .svg file added(highlighted version of tile)
  A tile is highlighted when clicked and remains highlighted until
  another tile or empty space is clicked.

12 years agoAllow selection of a tile by including any corner
Kevin Worth [Fri, 12 Jun 2009 13:54:26 +0000 (09:54 -0400)]
Allow selection of a tile by including any corner

      A group of tiles can now be selected by overlapping the
      selection_box with any corner of each tile(top-left,
      bottom-right, etc)

      Bug fix: previously, the corners of the selection_box were
      not being updated if the mouse was clicked without being
      dragged. Now, with each click, x2 is set equal to x1, and
      y2 to y1. Then, as before, they are updated as the mouse
      is dragged.

12 years agoFix tile dragging
Kevin Worth [Fri, 12 Jun 2009 12:27:17 +0000 (08:27 -0400)]
Fix tile dragging

    With the newly implemented "select_mode", it is now necessary to change
    select_mode as soon as "on_button_press_event" realizes a tile has
    been clicked on.

12 years agoAdd "select_mode" to determine if "selection_box.visible" is true or false
Kevin Worth [Sun, 7 Jun 2009 23:07:15 +0000 (19:07 -0400)]
Add "select_mode" to determine if "selection_box.visible" is true or false

    If "select_mode" is true(tile not being dragged) then
    selection_box.visible is true. Previously this check was done using
    "current_tile == -1", which was unclear.

    It could be said that it is redundant to set "select_mode" and *then*
    set "selection_box.visible" to true, but it very clearly shows what
    is being done and when. In addition, checking select_mode may be used
    later on with a completely different purpose.

12 years agoDraw a rectangle to clearly show which tiles are being selected.
Kevin Worth [Sun, 7 Jun 2009 16:36:58 +0000 (12:36 -0400)]
Draw a rectangle to clearly show which tiles are being selected.

     New "selection_box_t" struct has been added.
     "selection_box.visible" determines when the rectangle is(isn't) shown.

12 years agoFinal commit to fix indentation with mixed tabs and spaces
Kevin Worth [Fri, 29 May 2009 01:38:05 +0000 (21:38 -0400)]
Final commit to fix indentation with mixed tabs and spaces

12 years agoFirst attempt to fix indenting to mix of tabs and spaces
Kevin Worth [Thu, 28 May 2009 14:02:21 +0000 (10:02 -0400)]
First attempt to fix indenting to mix of tabs and spaces

      Kevin tried to fix things, and in his emacs the first level
      of indent appears to be 3 columns. This commit made so Carl
      can try and fix things and push them back

13 years agoSmall update to kub_todo.txt
Kevin Worth [Thu, 7 May 2009 20:15:03 +0000 (16:15 -0400)]
Small update to kub_todo.txt

13 years agoFix tile_group_is_set
Kevin Worth [Thu, 7 May 2009 19:15:43 +0000 (15:15 -0400)]
Fix tile_group_is_set

Previous version was validating sets with repeat colors.
The error appeared to be an incomplete check through the array;
when num_tiles was 3, it was checking index 0 and 1. Thus, if
index 0 and 2 had the same color, it wasn't being caught.

New version now steps through entire array.

13 years agoFix tile group validation functions
Kevin Worth [Thu, 7 May 2009 15:06:03 +0000 (11:06 -0400)]
Fix tile group validation functions

tile_group_is_set() has been tested
and appears to be working. No major changes
made here.

tile_group_is_run_one() has been tested and
appears to be working. This version has been
significantly revamped. The concept for the previous
version was "slick" but was flawed. One failure came
from testing a 3 tile group containing a yellow tile.
The yellow tile tried to increment index 3, but the max
index was 2.

no changes made to tile_group_is_run_two() which
has not been tested. It may not be needed unless
it can be shown to be "better" than _is_run_one()

13 years agoClick-n-drag to select multiple tiles
Kevin Worth [Wed, 6 May 2009 23:04:41 +0000 (19:04 -0400)]
Click-n-drag to select multiple tiles

The main purpose here is to facilitate testing of
the functions tile_group_is_set and tile_group_is_run.
Eventually it will be improved for general UI purposes.
Grouped tiles are printed to terminal.

XXX There is a bug here XXX
Selections must:
(a)start above the highest tile and catch all the
top left corners of each tile
(b)start below the lowest tile and catch all the
bottom left corners of each tile

13 years agoAdd first version of kub_todo.txt into repository
Kevin Worth [Wed, 6 May 2009 02:31:06 +0000 (22:31 -0400)]
Add first version of kub_todo.txt into repository

13 years agoFid indents broken from in previous commit(tabs now changed to 4 spaces)
Kevin Worth [Tue, 5 May 2009 23:07:01 +0000 (19:07 -0400)]
Fid indents broken from in previous commit(tabs now changed to 4 spaces)

13 years agoDraw 2 digit numbers *closer* to center of tile
Kevin Worth [Tue, 5 May 2009 01:25:12 +0000 (21:25 -0400)]
Draw 2 digit numbers *closer* to center of tile

15 years agoUse the expose event's region to avoid drawing tiles that don't need to be redrawn.
Carl Worth [Thu, 15 Mar 2007 16:25:54 +0000 (09:25 -0700)]
Use the expose event's region to avoid drawing tiles that don't need to be redrawn.

The reason that dragging was so slow before is that the program
was redrawing every single tile every time the mouse moved. Now
we only redraw tiles that are actually affected by the movement.

This is fast enough now that we probably don't even need to add
caches for pre-rendered tiles, (though of course, if we did that
it would be even faster).

15 years agoDeal in players and draw tiles for player 1(players[0])
Kevin Worth [Thu, 15 Mar 2007 01:05:55 +0000 (21:05 -0400)]
Deal in players and draw tiles for player 1(players[0])

15 years agoKeep cursor on original spot(of tile) clicked while dragging
Kevin Worth [Wed, 14 Mar 2007 21:24:10 +0000 (17:24 -0400)]
Keep cursor on original spot(of tile) clicked while dragging

15 years agoFix tile dragging(no tile dragged when blank area clicked)
Kevin Worth [Wed, 14 Mar 2007 21:00:49 +0000 (17:00 -0400)]
Fix tile dragging(no tile dragged when blank area clicked)

15 years agoFix bug causing garbage lines
Kevin Worth [Wed, 14 Mar 2007 16:06:38 +0000 (12:06 -0400)]
Fix bug causing garbage lines

15 years agoCommit to undo changes from previous commit
Kevin Worth [Wed, 14 Mar 2007 15:28:14 +0000 (11:28 -0400)]
Commit to undo changes from previous commit

15 years agoFixed bug so that when no tile is clicked, no tile moves.
Kevin Worth [Wed, 14 Mar 2007 15:02:17 +0000 (11:02 -0400)]
Fixed bug so that when no tile is clicked, no tile moves.

15 years agoMove tile movement/redraw code from on_button_press_event to on_button_motion_event
Carl Worth [Wed, 14 Mar 2007 14:35:26 +0000 (07:35 -0700)]
Move tile movement/redraw code from on_button_press_event to on_button_motion_event

We queue redraws rather than calling draw_tile directly so that we
only draw in the idle loop, for much better performance, (and for
proper interaction with GTK+'s double buffering).

15 years agoFix typo (should be motion_notify_event, not button_motion_event)
Carl Worth [Wed, 14 Mar 2007 14:33:10 +0000 (07:33 -0700)]
Fix typo (should be motion_notify_event, not button_motion_event)

This is some naming inconsistency in GTK+ that makes it confusing
to program, (probably left over from naming inconsistency in Xlib).

15 years agoAttempt at dragging tiles(compiles, but no dragging)
Kevin Worth [Tue, 13 Mar 2007 19:29:24 +0000 (15:29 -0400)]
Attempt at dragging tiles(compiles, but no dragging)

15 years agoCreated deck_spread which gives x, y values to tiles in deck, for drawing 8 rows...
Kevin Worth [Tue, 6 Mar 2007 12:45:02 +0000 (07:45 -0500)]
Created deck_spread which gives x, y values to tiles in deck, for drawing 8 rows of 13 tiles

15 years agoRevised deck_draw by removing obsolete for loops(now that tile_draw is handling the...
Kevin Worth [Tue, 6 Mar 2007 12:11:48 +0000 (07:11 -0500)]
Revised deck_draw by removing obsolete for loops(now that tile_draw is handling the x,y of where to print the tile)

15 years agoUse mouse clicks to position tiles one by one.
Carl Worth [Thu, 1 Mar 2007 15:09:58 +0000 (07:09 -0800)]
Use mouse clicks to position tiles one by one.

15 years agoMove tile dimensions as #defines into kub.c
Carl Worth [Thu, 1 Mar 2007 15:09:42 +0000 (07:09 -0800)]
Move tile dimensions as #defines into kub.c

15 years agoGive each tile its own position and use it to draw the tile.
Carl Worth [Thu, 1 Mar 2007 14:50:18 +0000 (06:50 -0800)]
Give each tile its own position and use it to draw the tile.

15 years agoBreakout new tile_init function from deck_init
Carl Worth [Thu, 1 Mar 2007 14:48:55 +0000 (06:48 -0800)]
Breakout new tile_init function from deck_init

15 years agoMerge branch 'master' of kevin:kub
Carl Worth [Thu, 1 Mar 2007 14:43:45 +0000 (06:43 -0800)]
Merge branch 'master' of kevin:kub

15 years agoRename card to tile
Carl Worth [Thu, 1 Mar 2007 14:43:00 +0000 (06:43 -0800)]
Rename card to tile

15 years agoRealized value for TILE_SUN_Y_OFFSET was missing from last commit
Kevin Worth [Wed, 21 Feb 2007 06:02:08 +0000 (01:02 -0500)]
Realized value for TILE_SUN_Y_OFFSET was missing from last commit

15 years agoCompleted tiledimensions.txt with missing values
Kevin Worth [Wed, 21 Feb 2007 03:47:51 +0000 (22:47 -0500)]
Completed tiledimensions.txt with missing values

15 years agoAdded tiledimensions.txt to document tile size constants
Kevin Worth [Tue, 20 Feb 2007 18:44:42 +0000 (13:44 -0500)]
Added tiledimensions.txt to document tile size constants

15 years agoDraw tiles as 1-13 instead of 0-12
Carl Worth [Tue, 20 Feb 2007 17:45:07 +0000 (09:45 -0800)]
Draw tiles as 1-13 instead of 0-12

A simple off-by-one error in card_draw.

15 years agoFix card_draw for multi-digit tiles.
Carl Worth [Tue, 20 Feb 2007 17:44:35 +0000 (09:44 -0800)]
Fix card_draw for multi-digit tiles.

Previously, for tiles > 9 we were just using the next larger
character values in ACII above '9'. Oops! Now, we're properly
using snprintf to format the number as an integer within the

15 years agoFixed deck_draw, though still have bugs in card_draw
Kevin Worth [Tue, 20 Feb 2007 15:22:53 +0000 (10:22 -0500)]
Fixed deck_draw, though still have bugs in card_draw

15 years agoStarted deck_draw, currently full of errors
Kevin Worth [Tue, 20 Feb 2007 14:50:45 +0000 (09:50 -0500)]
Started deck_draw, currently full of errors

15 years agoTemporarily add -Wno-unused-function
Carl Worth [Tue, 20 Feb 2007 14:17:50 +0000 (06:17 -0800)]
Temporarily add -Wno-unused-function

Generally, this is a useful warning to have turned on, but for now
while we have some unused functions still in-progress, let's turn it
off so that we can have clean, warning-free compilation.

15 years agoFix signature of card_compare to make qsort happy
Carl Worth [Tue, 20 Feb 2007 14:15:45 +0000 (06:15 -0800)]
Fix signature of card_compare to make qsort happy

It really wants to see 'const void *' arguments.

15 years agoFix compilation errors (& confusion)
Carl Worth [Tue, 20 Feb 2007 14:12:33 +0000 (06:12 -0800)]
Fix compilation errors (& confusion)

15 years agoAttempt at card_draw function, probably full of errors :)
Kevin Worth [Tue, 20 Feb 2007 13:44:15 +0000 (08:44 -0500)]
Attempt at card_draw function, probably full of errors :)

15 years agoResized blanktile now drawn in corner
Kevin Worth [Wed, 14 Feb 2007 19:59:58 +0000 (14:59 -0500)]
Resized blanktile now drawn in corner

15 years agoAdd comments about the various parts of the sun
Carl Worth [Wed, 14 Feb 2007 18:34:40 +0000 (10:34 -0800)]
Add comments about the various parts of the sun

15 years agoAdd tile and sun id attributes
Carl Worth [Wed, 14 Feb 2007 18:33:09 +0000 (10:33 -0800)]
Add tile and sun id attributes

15 years agoMove duplicated style attributes to enclosing group
Carl Worth [Wed, 14 Feb 2007 18:32:22 +0000 (10:32 -0800)]
Move duplicated style attributes to enclosing group

15 years agoStrip out most of the inkscape-specfic cruft from blanktile.svg
Carl Worth [Wed, 14 Feb 2007 17:56:34 +0000 (09:56 -0800)]
Strip out most of the inkscape-specfic cruft from blanktile.svg

15 years agoDraw blanktile.svg instead of red6.svg so that numbers can be added dynamically
Carl Worth [Wed, 14 Feb 2007 17:56:13 +0000 (09:56 -0800)]
Draw blanktile.svg instead of red6.svg so that numbers can be added dynamically

15 years agoAdd very basic usage of librsvg to draw a red tile.
Carl Worth [Wed, 14 Feb 2007 17:29:05 +0000 (09:29 -0800)]
Add very basic usage of librsvg to draw a red tile.

This is basically the minimal necessary support to start using
librsvg to render SVG graphics. Just a single, static red 6 tile
for now.

15 years agoAdd some cairo drawing (just a solid, red rectangle)
Carl Worth [Wed, 14 Feb 2007 17:26:08 +0000 (09:26 -0800)]
Add some cairo drawing (just a solid, red rectangle)

This is the minimal necessary code to be able to start drawing
with cairo.

15 years agoMerge branch 'master' of kevin:kub
Carl Worth [Wed, 14 Feb 2007 17:01:59 +0000 (09:01 -0800)]
Merge branch 'master' of kevin:kub



15 years agoDocument internals (and bug!) of card_group_is_run
Carl Worth [Wed, 14 Feb 2007 17:00:31 +0000 (09:00 -0800)]
Document internals (and bug!) of card_group_is_run

15 years agoAdd kub binary to .gitignore
Carl Worth [Wed, 14 Feb 2007 16:54:17 +0000 (08:54 -0800)]
Add kub binary to .gitignore

15 years agoOne final(hopefully) fix to qsort
Kevin Worth [Mon, 29 Jan 2007 18:07:17 +0000 (13:07 -0500)]
One final(hopefully) fix to qsort

15 years agoRemoved extra card_compare
Kevin Worth [Mon, 29 Jan 2007 18:02:43 +0000 (13:02 -0500)]
Removed extra card_compare

15 years agoCouple of attempts to fix qsort, per Carl's suggestions.
Kevin Worth [Mon, 29 Jan 2007 18:02:18 +0000 (13:02 -0500)]
Couple of attempts to fix qsort, per Carl's suggestions.

15 years agoAttempt at implementing qsort into card_group_is_run
Kevin Worth [Mon, 29 Jan 2007 16:45:54 +0000 (11:45 -0500)]
Attempt at implementing qsort into card_group_is_run

15 years agoImplement card_group_is_run with one loop instead of two.
Carl Worth [Mon, 29 Jan 2007 15:19:33 +0000 (07:19 -0800)]
Implement card_group_is_run with one loop instead of two.

It's simpler to just implement a single check for color in the same
loop that's examining the color of every card. We don't need to
check every pair of cards for matching color as we were in the old

15 years agoUse subraction to implement card_compare
Carl Worth [Mon, 29 Jan 2007 15:09:23 +0000 (07:09 -0800)]
Use subraction to implement card_compare

15 years agoFixed card_group_is_run to include last card in number compare
Kevin Worth [Mon, 29 Jan 2007 14:46:08 +0000 (09:46 -0500)]
Fixed card_group_is_run to include last card in number compare

15 years agoRemove duplicate definition of card_group_is_run
Carl Worth [Mon, 29 Jan 2007 14:22:36 +0000 (06:22 -0800)]
Remove duplicate definition of card_group_is_run

15 years agoAdd unconditional return value to card_compare
Carl Worth [Mon, 29 Jan 2007 14:22:09 +0000 (06:22 -0800)]
Add unconditional return value to card_compare

This avoids a wanring from gcc about a function possibly not returning
a value.

15 years agoFix syntax errors in card_compare
Carl Worth [Mon, 29 Jan 2007 14:21:18 +0000 (06:21 -0800)]
Fix syntax errors in card_compare

15 years agoAdd some minimal GTK+ love to kub
Carl Worth [Mon, 29 Jan 2007 14:14:50 +0000 (06:14 -0800)]
Add some minimal GTK+ love to kub

This initializes GTK+, creates a window, and establishes 4 callback functions
for handling expose, key press, and button press/release events. So far,
the callbacks are just printing things to stdout and not really doing anything
useful yet.

15 years agoAdded beginnings of card_compare and added to card_group_is_run(still incomplete)
Kevin Worth [Sat, 27 Jan 2007 20:17:43 +0000 (15:17 -0500)]
Added beginnings of card_compare and added to card_group_is_run(still incomplete)

15 years agoNew svg files of Kevin's Kub tiles
Kevin Worth [Mon, 15 Jan 2007 20:39:56 +0000 (12:39 -0800)]
New svg files of Kevin's Kub tiles

15 years agoKub can now _reliably_ shuffle deck and deal in 1-4 players
Kevin Worth [Sat, 4 Feb 2006 18:33:43 +0000 (10:33 -0800)]
Kub can now _reliably_ shuffle deck and deal in 1-4 players

15 years agoMinor fixes to kub
Kevin Worth [Sat, 21 Jan 2006 07:42:39 +0000 (23:42 -0800)]
Minor fixes to kub

15 years agoCompleted _is_set and _is_run but still lacking debugging code for said functions
Kevin Worth [Sat, 21 Jan 2006 07:38:14 +0000 (23:38 -0800)]
Completed _is_set and _is_run but still lacking debugging code for said functions

15 years agoFixed kub to print deck better(still not perfect)
Kevin Worth [Sun, 15 Jan 2006 07:50:42 +0000 (23:50 -0800)]
Fixed kub to print deck better(still not perfect)

15 years agoKub compiles with no errors but still plenty of bugs
Kevin Worth [Sat, 14 Jan 2006 18:50:49 +0000 (10:50 -0800)]
Kub compiles with no errors but still plenty of bugs

15 years agoAdd .gitignore file
Carl Worth [Sat, 27 Jan 2007 14:29:50 +0000 (06:29 -0800)]
Add .gitignore file

15 years agoAdd simple Makefile
Carl Worth [Sat, 27 Jan 2007 14:22:38 +0000 (06:22 -0800)]
Add simple Makefile

We needed a trivial little Makefile since we extracted kub
out of a former project that had been using automake.

15 years agoAdd kub program
Kevin Worth [Sat, 14 Jan 2006 17:01:24 +0000 (09:01 -0800)]
Add kub program