X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=main.coffee;h=00b7ae2e97826c69b3ba4174b935c9c58ee9e289;hb=923aac95deef59e3d70be18c06de82c63bbbf54b;hp=b44afb6b5cc0e21a7141199f07be543b20c7d9c3;hpb=418e647c63e4edd7853456a0f9b462f1ebe37fb6;p=hexbog.git diff --git a/main.coffee b/main.coffee index b44afb6..00b7ae2 100644 --- a/main.coffee +++ b/main.coffee @@ -313,7 +313,7 @@ save_game = -> # remove the selected tiles from the board, create new tiles, and slide everything into place blip_selection = -> - difficulty = 7 # higher numbers are easier + difficulty = 11 - Math.log(100 + score) # higher numbers are easier unsink = difficulty * score_for selected_word() # how much tile restoration we have left to do faders = selected.num_sort() selected = [] @@ -335,15 +335,17 @@ blip_selection = -> # convert to arrays so we can sort, etc nneighbors = (v for k, v of nneighbors) neighbors = (v for k, v of neighbors) - # TODO randsort neighbors and nneighbors + # TODO make this apply eavenly to neighbors + # TODO different range for different word lengths for nei in [neighbors, nneighbors] if unsink > 0 for i in nei - if i.hp is 0 and unsink >= 15 + if i.hp is 0 and unsink >= 10 i.new_hp = 10 - unsink -= 15 + unsink -= 10 i.text = new_letter() i.dom.html i.text + for nei in [neighbors, nneighbors] if unsink > 0 for i in nei if i.hp > 0 and unsink > 0 @@ -445,7 +447,7 @@ select_tile = (num) -> new_tile = (num, x, y) -> letter = new_letter() - hp = Math.floor(Math.random() * HP_MAX) + hp = 1 + Math.floor(Math.random() * (HP_MAX - 1)) html_tile = $("
#{letter}
") $board.append(html_tile) @@ -456,6 +458,7 @@ new_tile = (num, x, y) -> html_tile.click -> me = $(this) num = me.data 'tile_number' + return if tiles[num].hp < 1 if num in selected nth_of_word = selected.indexOf(num) first = nth_of_word is 0