해드 설정 문의 드립니다. 정보
해드 설정 문의 드립니다.본문
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=99181
[포인트 연동 게임] 스도쿠 (ver.1.0) 인데요.
이게임을 창을 띠우지 않고 사용하고 싶은데 어떻게 설정을 해야 하는지요?
index.php 에 아래와 같이 인크루트 시켰는데 오류가 납니다.
Warning: include_once(/_head.php) [function.include-once]: failed to open stream: No such file or directory in /home/hosting_users/xxxx/www/game/sdoku/index.php on line 2
Warning: include_once() [function.include]: Failed opening '/_head.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/hosting_users/xxxx/www/game/sdoku/index.php on line 2
<?
include_once("$g4[path]/_head.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>낄낄닷컴 스도쿠 게임</title>
</head>
<style>
body {
font-family: thaoma;
margin:0;
font-size: 12px;
color: #000000;
background: #EFEFEF;
}
a {
color: #FF0000;
}
.div-board {
padding:15px 0 0 15px;
}
.table-main {
margin-top:10px;
border: 1px solid #000000;
color: #000000;
background: #FFFFFF;
}
.table-region {
border: 1px solid #000000;
}
.table-region td {
border: 1px solid #CFCFCF;
}
.cell, .cell-disable {
height: 25px;
width: 25px;
font-family: Arial;
font-size: 16px;
font-weight: bold;
text-align: center;
border: 0;
}
.cell-disable {
color: #0000FF;
}
.bn-validate {
margin-top: 15px;
font-family: Arial;
font-size: 14px;
font-weight: bold;
}
.div-adsense {
position: absolute;
left: 10px;
top: 400px;
width: 560px;
text-align: center;
}
.div-addfreestats {
position: absolute;
left: 0px;
top: 0px;
display: none;
}
</style>
<body>
<div id="div-board" class="div-board">
새로고침 하면 다른 문제로 변경됩니다.
<table id="table0" class="table-main" cellspacing="0" cellpadding="0">
<tr>
<td><table id="table1" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c0" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c1" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c2" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c9" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c10" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c11" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c18" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c19" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c20" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
<td><table id="table2" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c3" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c4" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c5" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c12" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c13" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c14" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c21" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c22" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c23" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
<td><table id="table3" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c6" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c7" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c8" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c15" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c16" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c17" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c24" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c25" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c26" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
</tr>
<tr>
<td><table id="table4" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c27" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c28" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c29" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c36" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c37" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c38" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c45" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c46" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c47" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
<td><table id="table5" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c30" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c31" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c32" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c39" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c40" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c41" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c48" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c49" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c50" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
<td><table id="table6" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c33" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c34" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c35" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c42" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c43" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c44" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c51" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c52" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c53" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
</tr>
<tr>
<td><table id="table7" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c54" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c55" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c56" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c63" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c64" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c65" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c72" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c73" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c74" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
<td><table id="table8" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c57" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c58" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c59" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c66" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c67" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c68" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c75" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c76" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c77" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
<td><table id="table9" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c60" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c61" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c62" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c69" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c70" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c71" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c78" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c79" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c80" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
</tr>
</table>
<input id="bn-validate" type="button" class="bn-validate" onClick="game.validate()" value="작성 완료 후 누르세요.." name="bn-validate"/>
</div>
<script type="text/javascript">
function Game() {
this.board = new Board();
this.run = function() {
this.board.start();
}
this.validate = function() {
this.board.validate();
}
}
//
// Board
//
function Board() {
this.grid = new Grid();
this.sudoku = new Array();
this.start = function() {
this.generateSudoku();
this.showTips();
}
this.generateSudoku = function() {
this.initSudoku();
this.generateCell(0);
}
this.initSudoku = function() {
for (var row = 0; row < this.grid.rows; ++ row)
this.sudoku[row] = new Array(this.grid.cols);
}
this.generateCell = function(id) {
if (id == this.grid.rows * this.grid.cols)
return(true);
var row = Math.floor(id / this.grid.rows);
var col = id - (row * this.grid.rows)
var suit = this.shuffle(this.grid.suit);
for (var index in suit) {
this.sudoku[row][col] = suit[index];
if ( this.isValidCell(row, col) )
if ( this.generateCell(id + 1) )
return(true);
}
this.sudoku[row][col] = null;
return(false);
}
this.isValidCell = function(row, col) {
return( this.isValidRow(row, col) &&
this.isValidColumn(row, col) &&
this.isValidRegion(row, col) );
}
this.isValidRow = function(row, col) {
var count = new Array();
for (var c = 0; c <= col; ++ c) {
if (count[ this.sudoku[row][c] ] != null)
return(false);
count[ this.sudoku[row][c] ] = 1;
}
return(true);
}
this.isValidColumn = function(row, col) {
var count = new Array();
for (var r = 0; r <= row; ++ r) {
if (count[ this.sudoku[r][col] ] != null)
return(false);
count[ this.sudoku[r][col] ] = 1;
}
return(true);
}
this.isValidRegion = function(row, col) {
var count = new Array();
var rowi = this.grid.region * Math.floor(row / this.grid.region);
var coli = this.grid.region * Math.floor(col / this.grid.region);
for (var r = rowi; r <= row; ++ r)
for (var c = coli; c <= col; ++ c) {
if ( count[ this.sudoku[r][c] ] != null)
return(false);
count[ this.sudoku[r][c] ] = 1;
}
return(true);
}
this.showTips = function() {
var spans = this.shuffle(this.grid.spans);
for (var row = 0; row < this.grid.rows; ++ row) {
var tips = this.shuffle(this.grid.tips);
for (var col = 0; col < spans[row]; ++ col)
this.grid.setCellValue(row, tips[col], this.sudoku[row][ tips[col] ]);
}
}
this.validate = function() {
if ( this.isValidSudoku() ){
alert("축하합니다.\n\n F5키를 누르면 새로운 게임을 시작할 수 있습니다.");
location.href='./up_point.php?game_point=100';
}else{
alert("음!! 정답이 아닌데요..");
}}
this.isValidSudoku = function() {
var cells = this.grid.getCellValues();
var valid = true;
for (var row in this.sudoku)
for (var col in this.sudoku[row])
if (cells[row][col] != this.sudoku[row][col]) {
valid = false;
break;
}
return(valid);
}
this.shuffle = function(suit) {
for (var i in suit)
suit = swap(suit, i, Math.floor( Math.random() * suit.length ) );
return(suit);
}
}
//
// Grid
//
function Grid() {
this.rows = 9;
this.cols = 9;
this.region = 3;
this.spans = new Array(4, 4, 4, 3, 3, 3, 2, 2, 2);
this.tips = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8);
this.suit = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9);
this.getCellId = function(row, col) {
return("c" + String( (row * this.rows) + col) );
}
this.getCell = function(id) {
return( document.getElementById(id) );
}
this.getCellValue = function(row, col) {
return( this.getCellValueById( this.getCellId(row, col) ) );
}
this.getCellValueById = function(id) {
return( this.getCell(id).value );
}
this.setCellValue = function(row, col, value) {
this.setCellValueById( this.getCellId(row, col), value);
}
this.setCellValueById = function(id, value) {
var cell = this.getCell(id);
cell.value = String(value);
cell.className = "cell-disable";
cell.readOnly = "readonly";
}
this.getCellValues = function() {
var cells = new Array();
for (var row = 0; row < this.rows; ++ row) {
cells[row] = new Array();
for (var col = 0; col < this.cols; ++ col)
cells[row][col] = this.getCellValue(row, col);
}
return(cells);
}
}
function swap(array, i, j) {
var temp = array[i];
array[i] = array[j];
array[j] = temp;
return(array);
}
function getKeyCode(e) {
return(e? e.keyCode: window.event.keyCode);
}
document.onkeydown = function(e){
if( getKeyCode(e) == 116) {
window.location.reload(true);
return(false);
}
}
var game = new Game;
game.run();
</script>
</body>
</html>
<?
include_once("$g4[path]/_tail.php");
?>
[포인트 연동 게임] 스도쿠 (ver.1.0) 인데요.
이게임을 창을 띠우지 않고 사용하고 싶은데 어떻게 설정을 해야 하는지요?
index.php 에 아래와 같이 인크루트 시켰는데 오류가 납니다.
Warning: include_once(/_head.php) [function.include-once]: failed to open stream: No such file or directory in /home/hosting_users/xxxx/www/game/sdoku/index.php on line 2
Warning: include_once() [function.include]: Failed opening '/_head.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/hosting_users/xxxx/www/game/sdoku/index.php on line 2
<?
include_once("$g4[path]/_head.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>낄낄닷컴 스도쿠 게임</title>
</head>
<style>
body {
font-family: thaoma;
margin:0;
font-size: 12px;
color: #000000;
background: #EFEFEF;
}
a {
color: #FF0000;
}
.div-board {
padding:15px 0 0 15px;
}
.table-main {
margin-top:10px;
border: 1px solid #000000;
color: #000000;
background: #FFFFFF;
}
.table-region {
border: 1px solid #000000;
}
.table-region td {
border: 1px solid #CFCFCF;
}
.cell, .cell-disable {
height: 25px;
width: 25px;
font-family: Arial;
font-size: 16px;
font-weight: bold;
text-align: center;
border: 0;
}
.cell-disable {
color: #0000FF;
}
.bn-validate {
margin-top: 15px;
font-family: Arial;
font-size: 14px;
font-weight: bold;
}
.div-adsense {
position: absolute;
left: 10px;
top: 400px;
width: 560px;
text-align: center;
}
.div-addfreestats {
position: absolute;
left: 0px;
top: 0px;
display: none;
}
</style>
<body>
<div id="div-board" class="div-board">
새로고침 하면 다른 문제로 변경됩니다.
<table id="table0" class="table-main" cellspacing="0" cellpadding="0">
<tr>
<td><table id="table1" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c0" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c1" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c2" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c9" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c10" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c11" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c18" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c19" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c20" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
<td><table id="table2" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c3" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c4" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c5" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c12" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c13" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c14" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c21" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c22" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c23" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
<td><table id="table3" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c6" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c7" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c8" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c15" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c16" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c17" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c24" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c25" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c26" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
</tr>
<tr>
<td><table id="table4" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c27" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c28" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c29" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c36" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c37" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c38" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c45" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c46" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c47" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
<td><table id="table5" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c30" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c31" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c32" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c39" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c40" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c41" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c48" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c49" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c50" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
<td><table id="table6" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c33" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c34" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c35" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c42" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c43" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c44" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c51" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c52" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c53" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
</tr>
<tr>
<td><table id="table7" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c54" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c55" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c56" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c63" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c64" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c65" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c72" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c73" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c74" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
<td><table id="table8" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c57" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c58" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c59" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c66" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c67" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c68" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c75" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c76" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c77" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
<td><table id="table9" class="table-region" cellspacing="0" cellpadding="0">
<tr>
<td><input id="c60" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c61" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c62" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c69" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c70" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c71" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
<tr>
<td><input id="c78" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c79" class="cell" type="text" size="1" maxlength="1"></td>
<td><input id="c80" class="cell" type="text" size="1" maxlength="1"></td>
</tr>
</table></td>
</tr>
</table>
<input id="bn-validate" type="button" class="bn-validate" onClick="game.validate()" value="작성 완료 후 누르세요.." name="bn-validate"/>
</div>
<script type="text/javascript">
function Game() {
this.board = new Board();
this.run = function() {
this.board.start();
}
this.validate = function() {
this.board.validate();
}
}
//
// Board
//
function Board() {
this.grid = new Grid();
this.sudoku = new Array();
this.start = function() {
this.generateSudoku();
this.showTips();
}
this.generateSudoku = function() {
this.initSudoku();
this.generateCell(0);
}
this.initSudoku = function() {
for (var row = 0; row < this.grid.rows; ++ row)
this.sudoku[row] = new Array(this.grid.cols);
}
this.generateCell = function(id) {
if (id == this.grid.rows * this.grid.cols)
return(true);
var row = Math.floor(id / this.grid.rows);
var col = id - (row * this.grid.rows)
var suit = this.shuffle(this.grid.suit);
for (var index in suit) {
this.sudoku[row][col] = suit[index];
if ( this.isValidCell(row, col) )
if ( this.generateCell(id + 1) )
return(true);
}
this.sudoku[row][col] = null;
return(false);
}
this.isValidCell = function(row, col) {
return( this.isValidRow(row, col) &&
this.isValidColumn(row, col) &&
this.isValidRegion(row, col) );
}
this.isValidRow = function(row, col) {
var count = new Array();
for (var c = 0; c <= col; ++ c) {
if (count[ this.sudoku[row][c] ] != null)
return(false);
count[ this.sudoku[row][c] ] = 1;
}
return(true);
}
this.isValidColumn = function(row, col) {
var count = new Array();
for (var r = 0; r <= row; ++ r) {
if (count[ this.sudoku[r][col] ] != null)
return(false);
count[ this.sudoku[r][col] ] = 1;
}
return(true);
}
this.isValidRegion = function(row, col) {
var count = new Array();
var rowi = this.grid.region * Math.floor(row / this.grid.region);
var coli = this.grid.region * Math.floor(col / this.grid.region);
for (var r = rowi; r <= row; ++ r)
for (var c = coli; c <= col; ++ c) {
if ( count[ this.sudoku[r][c] ] != null)
return(false);
count[ this.sudoku[r][c] ] = 1;
}
return(true);
}
this.showTips = function() {
var spans = this.shuffle(this.grid.spans);
for (var row = 0; row < this.grid.rows; ++ row) {
var tips = this.shuffle(this.grid.tips);
for (var col = 0; col < spans[row]; ++ col)
this.grid.setCellValue(row, tips[col], this.sudoku[row][ tips[col] ]);
}
}
this.validate = function() {
if ( this.isValidSudoku() ){
alert("축하합니다.\n\n F5키를 누르면 새로운 게임을 시작할 수 있습니다.");
location.href='./up_point.php?game_point=100';
}else{
alert("음!! 정답이 아닌데요..");
}}
this.isValidSudoku = function() {
var cells = this.grid.getCellValues();
var valid = true;
for (var row in this.sudoku)
for (var col in this.sudoku[row])
if (cells[row][col] != this.sudoku[row][col]) {
valid = false;
break;
}
return(valid);
}
this.shuffle = function(suit) {
for (var i in suit)
suit = swap(suit, i, Math.floor( Math.random() * suit.length ) );
return(suit);
}
}
//
// Grid
//
function Grid() {
this.rows = 9;
this.cols = 9;
this.region = 3;
this.spans = new Array(4, 4, 4, 3, 3, 3, 2, 2, 2);
this.tips = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8);
this.suit = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9);
this.getCellId = function(row, col) {
return("c" + String( (row * this.rows) + col) );
}
this.getCell = function(id) {
return( document.getElementById(id) );
}
this.getCellValue = function(row, col) {
return( this.getCellValueById( this.getCellId(row, col) ) );
}
this.getCellValueById = function(id) {
return( this.getCell(id).value );
}
this.setCellValue = function(row, col, value) {
this.setCellValueById( this.getCellId(row, col), value);
}
this.setCellValueById = function(id, value) {
var cell = this.getCell(id);
cell.value = String(value);
cell.className = "cell-disable";
cell.readOnly = "readonly";
}
this.getCellValues = function() {
var cells = new Array();
for (var row = 0; row < this.rows; ++ row) {
cells[row] = new Array();
for (var col = 0; col < this.cols; ++ col)
cells[row][col] = this.getCellValue(row, col);
}
return(cells);
}
}
function swap(array, i, j) {
var temp = array[i];
array[i] = array[j];
array[j] = temp;
return(array);
}
function getKeyCode(e) {
return(e? e.keyCode: window.event.keyCode);
}
document.onkeydown = function(e){
if( getKeyCode(e) == 116) {
window.location.reload(true);
return(false);
}
}
var game = new Game;
game.run();
</script>
</body>
</html>
<?
include_once("$g4[path]/_tail.php");
?>
댓글 전체
<?
include_once("./_common.php");
include_once("$g4[path]/_head.php");
?>
include_once("./_common.php");
include_once("$g4[path]/_head.php");
?>
답변 감사합니다..
근데 아래와 같이 오류가 뜹니다..
Warning: include_once(./_common.php) [function.include-once]: failed to open stream: No such file or directory in /home/hosting_users/xxx/www/game/sdoku/index.php on line 2
Warning: include_once() [function.include]: Failed opening './_common.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/hosting_users/xxx/www/game/sdoku/index.php on line 2
Warning: include_once(/_head.php) [function.include-once]: failed to open stream: No such file or directory in /home/hosting_users/xxx/www/game/sdoku/index.php on line 3
Warning: include_once() [function.include]: Failed opening '/_head.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/hosting_users/xxx/www/game/sdoku/index.php on line 3
근데 아래와 같이 오류가 뜹니다..
Warning: include_once(./_common.php) [function.include-once]: failed to open stream: No such file or directory in /home/hosting_users/xxx/www/game/sdoku/index.php on line 2
Warning: include_once() [function.include]: Failed opening './_common.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/hosting_users/xxx/www/game/sdoku/index.php on line 2
Warning: include_once(/_head.php) [function.include-once]: failed to open stream: No such file or directory in /home/hosting_users/xxx/www/game/sdoku/index.php on line 3
Warning: include_once() [function.include]: Failed opening '/_head.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/hosting_users/xxx/www/game/sdoku/index.php on line 3
위 오류파일이 몽땅 없다는군요 common 파일을 정확히 만들어주세요