Commit graph

116 commits

Author SHA1 Message Date
Andy2
fab39a5f87 Trying to deal with old- and new-proto devices interacting. Fix
clients to append their stream version to their inital connect
message.  (The format can't change, so detecting additional length was
the only option.  comm.c on existing clients won't allow more than one
connect message per channel, so adding a new to be used in addition
didn't work.)  New servers detect this; old will ignore.  Track the
version (implicit or not) of all clients, and use the lowest any
supports, so that new server and all new clients will use newer proto.
2011-11-16 06:47:55 -08:00
Andy2
bdb8e6f03c fix several crashers that prevented network games from working when
MAX_COLS was larger than 16.  In order that old-style messages on
relay be readable by new-style code on device, modified server.c's
protocol to include stream version.  But: unless I come up with a
better way of doing this all devices will have to be upgraded at the
same time: old won't be able to read the new format as it's done here.
2011-11-15 06:13:25 -08:00
Eric House
619c25ee49 add a bit of logging to help deciphering test app problems. 2011-11-10 18:28:11 -08:00
Andy2
af5c8a096f don't pass a pointer to a tray inside the model to model code that
will modify that tray!  Fixes nasty random crash/assertion failure.
2011-11-10 06:35:05 -08:00
Andy2
8d228ae190 turn on face-up tile picking for Android (though there's no prefs UI
to enable it for a game yet).  In common code, break pick tile utils
method in two, one for blank and the other for tray tiles.  In java,
implement dialog for picking the tiles.  Works, though is a bit clumsy
to have the dialog come and go after every pick.  Better would be a
dialog that stays up and accumulates picks -- but it'd have to know to
reduce the set of tile choices as letters are chosen.  This'll do for
now.
2011-10-28 22:15:56 -07:00
Andy2
4eee7f8aa7 Pass selected tiles into new util function, and from there into java
world, so confirming query can include them.
2011-10-19 18:34:26 -07:00
Andy2
c2a7a5c347 fix crash: don't destroy stream if for some reason it's null. Not
sure how that happens, but it does.
2011-10-18 21:29:40 -07:00
Andy2
b31e829414 Remove file-format differences between debug and non-debug versions.
Fix curses to compile non-debug.
2011-10-18 18:52:37 -07:00
Andy2
8062a027e7 cleanup: NULL's a legal value now. 2011-10-17 06:48:13 -07:00
Andy2
0e6b4d749f When pen held on committed tile on board, cons up list of all words
played that include that tile and pass to new util_cellSquareHeld()
method.  In java implementation of that method, use existing lookup
activity code to display list of words.  Enabled on the C side by a
compile-time flag in case it has problems.  Right now the time spent
saving a game before launching the lookup activity, and reloading it
after, is pretty apparent, but that's in emulator which is slow.
2011-10-13 19:14:08 -07:00
Andy2
4bb61401bd fix crash: src and dest stream params were reversed. 2011-10-10 22:24:44 -07:00
Andy2
dc20b04a4c remove unused param (on the C/jni side) 2011-10-04 18:54:53 -07:00
Andy2
c04f981442 fix new word-list reporting to work for networked games too: create
and save a second stream parallel to the existing one reporting the
move scoring.  Requires bump in stream version.
2011-10-04 06:44:29 -07:00
Andy2
77b9fa11a5 improving lookup words experience: replace
util_userQuery(QUERY_ROBOT_MOVE) with new util_informMove(), into
which the number of words formed and the words themselves are passed.
The process of consing up the score explanation was already passing
over the model, so storing the words is very little effort, and will
save a call back into the model where the user actually wants to do
the lookup.
2011-10-02 16:21:09 -07:00
Andy2
35a0a3a291 passing pool into word-listing code a mistake as it put tiles back
when undoing and so the pool grew each time.  Fix, and remove server
API as it's unneeded.
2011-09-22 06:41:48 -07:00
Andy2
9eacdb3856 add server_listWordsPlayed, and implement via function in model.c that
uses existing stack and undo features to run a WordNotifierInfo over
some number of scoring passes to gather the words seen.  Seems to work
as tested from gtk version.  Now need to try from android....
2011-09-18 17:20:01 -07:00
Andy2
63893b8a0d add stream_getPtr() and use to remove a couple of allocs, including
one per message sent.
2011-09-18 16:54:36 -07:00
Andy2
201db9415c sort tiles after trade too 2011-09-09 18:32:04 -07:00
Andy2
e4b952222a unify two ways of saving words encountered during scoring, removing
one and changing the site that used it to use the other.  Not visible
outside of common, but should make it easier to harvest a list of all
words for one move or the entire game.
2011-09-02 19:11:04 -07:00
Eric House
febb640049 add name of remote player to notification that remote player moved.
And remove a few dead strings.
2011-07-15 18:13:55 -07:00
Andy2
42e7a113b9 tweak logging 2011-07-12 07:09:40 -07:00
Andy2
4b75174170 save stateAfterShow as part of serialized game state. Fixes problem
where games with more than two devices would hang because server.c
code was dropping messages that comms.c code thought were good and so
ACK'd preventing them from being sent again.  They were being dropped
because the game was in the wrong state after displaying a move-made
dialog because the state it was to move to after doing that display
had not been saved.
2011-07-04 12:51:00 -07:00
eehouse@eehouse.org
484bb295d0 Merge branch 'android_branch' into android_invite 2011-06-06 22:08:49 -07:00
Andy2
1bc70f2c8f google reports a crash in warnIllegalWord that only makes sense if I'm
passing a 0-length array of bad words.  That in turn suggests a
screwup where a move's rejected for some reason other that a word not
being in the dictionary.  This is all supposition, and all stuff
that'd be caught by asserts in a debug build, but: when there are no
bad words don't report them -- even if the move's rejected.
2011-06-06 20:33:10 -07:00
Andy2
a29f08616e what I meant to check in. 2011-05-19 22:53:58 -07:00
Andy2
89911ecaa4 add server_getMissingPlayers to return a bitvector indicating players
not yet received on device.  Meant to be included in summary.  I'm not
happy with how much code it took to figure this.  I don't know
server.c all that well any more.
2011-05-19 22:48:21 -07:00
Andy2
4e7570020f remove mistaken (I think) assert 2011-04-20 22:13:44 -07:00
Andy2
002bb40a09 report counts/values using language rather than dictionary name. To
support that, pass lang name from java into jni.
2011-04-11 18:55:42 -07:00
Andy2
3b7b4802a9 add ability to specify, track and use separate dictionaries for each
player.  Works for gtk client.  Compiles for Android but there's no UI
yet to specify more than one dict.  Management of dupicate dicts
without duplicating memory -- refcounting -- will be up to the
platforms.
2011-04-01 19:57:10 -07:00
Andy2
d2fda267e5 fix assertion failure that happened when I changed whether remote
scores were shown mid-game.  If the value's not as expected just don't
show the score.
2011-02-18 17:43:01 -08:00
Andy2
c56f0b5cea Save cached prev move explanation as part of stream so can be shown to
user when game is opened later. Fixes problem displaying empty
explanation on first open of game that was updated in the background.
2011-02-09 06:30:51 -08:00
Andy2
7d6e136ca3 fix comment 2011-01-19 06:21:31 -08:00
Andy2
f111b78714 switch from tracking robot intelligence as a per-game boolean
implemented (when not smart) as trying to match the human's score to a
per-robot value between 1 and 100 that gives the percentage of best
moves to store before picking randomly from among them.  So a 1 means
save only the best move and always pick it; 100 means save all the
best moves (how many are saved is compile-time configurable) and pick
one of them.  Because it's settable per-robot a smarter robot can be
played against a dumber one (though I may choose not to make it
settable per-robot on shipping versions.)
2011-01-10 06:44:28 -08:00
Andy2
4a12f7a96f Revert "in attempt to work around non-random rand() in jni world, call back"
This reverts commit 99c92e779d.

Conflicts:

	xwords4/android/XWords4/jni/utilwrapper.c
2010-12-07 18:43:53 -08:00
Andy2
99c92e779d in attempt to work around non-random rand() in jni world, call back
into the java world by making it a util_ctxt function.  Do same on
linux to test.  We'll see how it is -- and can back this commit out if
there's no improvement.
2010-12-02 19:02:36 -08:00
Andy2
3d70da5a8d cleanup 2010-11-01 06:57:54 -07:00
Eric House
61b228f189 implement simple chat on top of current server-level protocol --
meaning it'll work on any tranport but relay doesn't know about it.
(If relay knew about it I could send a "shutting down for a minute"
message to every connected device, which would be cool.  But this is
easier.)  Written, BTW, enroute from Seattle with help from beer from
Chris in first class. :-)
2010-10-03 18:11:51 -07:00
Eric House
54611df679 nuke unused variable 2010-09-10 05:55:59 -07:00
Andy2
20312144dd tons of changes, still rough, snapshoted here: a gtk device vs device
game works to completion with both signing up as guests (no -s) with
one local and one remote player (identical commandlines.)  Not yet
tested: if any signs up as a host, reconnecting rather than
connecting, etc.  This is just a snapshot.
2010-09-10 01:30:40 -07:00
Andy2
3dba8ba13b Fix bug reported by user: if robot finishes a search but fails to find
a move it's still done with its turn and must trade or pass.
2010-08-24 18:38:12 -07:00
Andy2
992f45e1bf new feature: previous move. Modify engine to traverse the set of all
possible moves in either order both within a cached subset and when
building cached subsets.  Still a bit buggy (shows the same move twice
when moving backwards and reaches the top-scoring move) and not well
tested.
2010-07-07 05:27:57 -07:00
Andy2
80aa22b2d1 add common prefs field sortNewTiles and way to set on linux cmdline 2010-06-17 18:10:32 -07:00
Andy2
e0dd3701a0 Add model_sortTiles(); use it; fix some comments and const decls.
Sorting always happens now when tiles added; needs to be based on a
preference.
2010-06-17 06:43:16 -07:00
eehouse
f5ac51ae73 fix crash using older dict by using current stream version rather than
one from before gameSeconds was being preserved in the stream by
write_gi code.  I fixed this on a branch a week ago as well, so look
for a merge glitch.  Need now to confirm that I'm sending char lists
in initial connect message in the right (null-separated utf8) format.
2010-05-28 02:31:13 +00:00
eehouse
6d1c09e756 fix compile errors introduced by addition of const 2010-02-27 18:03:22 +00:00
eehouse
fc2e87e0c4 drop client connection when in the wrong state rather than asserting. 2010-02-11 13:29:28 +00:00
eehouse
41472c4984 assert have at least one remote player 2010-01-31 21:13:31 +00:00
ehouse
edde3e2fd5 cleanup 2009-09-26 14:33:52 +00:00
ehouse
a91fd28773 fix some warnings when building linux client without debugging but
with warnings as errors.
2009-09-20 21:51:29 +00:00
ehouse
e746e2bc5b Fix assertion failures 2009-07-31 13:03:38 +00:00