canvasでやる意味がないような気がします
javascript
1<style>
2#view{display:flex;}
3#view div{border:solid 1px;border-radius:5px;padding:0px 2px 0px 2px ;}
4#view div:not(:first-child){margin-left:10px;}
5#view [data-disabled]{background-Color:gray;}
6</style>
7
8<script>
9window.addEventListener('DOMContentLoaded', ()=>{
10 const q="Many people visit London every year .";
11 const view=document.querySelector('#view');
12 const q_arr=q.split(' ')
13 .map(x=>[x,Math.random()])
14 .sort((x,y)=>x[1]-y[1])
15 .map(x=>x[0]);
16 q_arr.forEach(x=>view.append(Object.assign(document.createElement('div'),{textContent:x})));
17 const a_arr=[];
18 document.querySelectorAll('#view div').forEach(x=>{
19 x.addEventListener('click',e=>{
20 if(!e.target.closest('[data-disabled]')){
21 a_arr.push(e.target.textContent);
22 e.target.setAttribute('data-disabled',1);
23 ans.textContent=a_arr.join(" ");
24 if(a_arr.length==q_arr.length){
25 document.querySelector('#judge').textContent=q==ans.textContent?'正解!':'不正解';
26 }
27 }
28 });
29 });
30 document.querySelector('#reset').addEventListener('click',e=>{
31 a_arr.length=0;
32 document.querySelectorAll('[data-disabled]').forEach(x=>x.removeAttribute('data-disabled'));
33 document.querySelectorAll('#ans,#judge').forEach(x=>x.textContent='');
34 });
35});
36</script>
37<div id="view"></div>
38<input type="button" id="reset" value="リセット">
39<div id="ans"></div>
40<div id="judge"></div>
41