(sample, featuresAndLabel)
| 103 | * sample, suitable to feed into the model. |
| 104 | */ |
| 105 | export function displaySimulation(sample, featuresAndLabel) { |
| 106 | const player1Row = document.getElementById('player1-row'); |
| 107 | player1Row.innerHTML = ''; |
| 108 | // Player 1 simulation cells. |
| 109 | for (let i = 0; i < game.GAME_STATE.num_cards_per_hand; i++) { |
| 110 | const newDiv = document.createElement('div'); |
| 111 | newDiv.className = 'divTableCell'; |
| 112 | newDiv.innerText = sample.player1Hand[i]; |
| 113 | player1Row.appendChild(newDiv); |
| 114 | } |
| 115 | |
| 116 | const player2Row = document.getElementById('player2-row'); |
| 117 | player2Row.innerHTML = ''; |
| 118 | // Player 2 simulation cells. |
| 119 | for (let i = 0; i < game.GAME_STATE.num_cards_per_hand; i++) { |
| 120 | const newDiv = document.createElement('div'); |
| 121 | newDiv.className = 'divTableCell'; |
| 122 | newDiv.innerText = sample.player2Hand[i]; |
| 123 | player2Row.appendChild(newDiv); |
| 124 | } |
| 125 | |
| 126 | const resultRow = document.getElementById('result-row'); |
| 127 | resultRow.innerHTML = ''; |
| 128 | // Result row. |
| 129 | const newDiv = document.createElement('div'); |
| 130 | newDiv.className = 'divTableCell'; |
| 131 | newDiv.innerText = sample.player1Win; |
| 132 | resultRow.appendChild(newDiv); |
| 133 | |
| 134 | const features = featuresAndLabel.features.dataSync(); |
| 135 | const label = featuresAndLabel.label.dataSync(); |
| 136 | document.getElementById('sim-features').innerText = |
| 137 | JSON.stringify(featuresAndLabelsToPrettyString(features)); |
| 138 | document.getElementById('sim-label').innerText = label; |
| 139 | }; |
| 140 | |
| 141 | /** |
| 142 | * Creates an HTML table, using div elements, to display the generated sample |
nothing calls this directly
no test coverage detected